home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / tegl_c.exe / TEGLDOC.ZIP / TEGLDISK.PRN < prev    next >
Encoding:
Text File  |  1990-06-28  |  489.9 KB  |  15,923 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.                            TEGL Windows Toolkit II
  23.                                 Release 1.10
  24.                         Programmer's Reference Guide
  25.  
  26.                 Copyright (C) 1990, TEGL Systems Corporation
  27.                              All rights reserved
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.                                          TEGL Systems Corporation
  45.                                          Suite 780, 789 West Pender Street
  46.                                          Vancouver, British Columbia
  47.                                          Canada V6C 1H2
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. TEGL Windows Toolkit II
  65.  
  66. LICENSE AGREEMENT
  67.  
  68. TEGL software products are protected under both Canada copyright
  69. law and international treaty provisions.
  70.  
  71. You have the non-exclusive right to use the enclosed software under the
  72. following terms and conditions.
  73.  
  74. You may use this software on a single machine, for both personal and
  75. business use; and may make copies of the software solely for backup
  76. purposes. Other than this you agree to use this software "like a book",
  77. meaning the software may be used by any number of people and may be moved
  78. from one computer to another so long as there is no possibility of it being
  79. used by more than one person at one time.
  80.  
  81. Programs that you write and compile using the TEGL Windows Toolkit may be
  82. used, given away, or sold without additional license or fees as long as
  83. all copies of such programs bear a copyright notice. By "copyright notice"
  84. we mean either your own copyright notice or if you prefer, the following
  85. statement, "Created using TEGL Windows Toolkit, copyright (C) 1989, 1990,
  86. TEGL Systems Corporation. All rights reserved".
  87.  
  88. Included on the TEGL Windows Toolkit diskettes are a number of support
  89. files that contain encoded hardware and font information used by the
  90. standard graphic unit. These files are proprietary to TEGL. You may use
  91. these files with the programs you create with the TEGL Windows Toolkit for
  92. your own personal or business use.  To the extent the programs you write
  93. and compile using the TEGL Windows Toolkit make use of these support files,
  94. you may distribute in combination with such programs, provided you do not
  95. use, give away, or sell these support files separately, and all copies of
  96. your programs bear a copyright notice.
  97.  
  98. The Complete Games Toolkit  diskettes provide a demonstration on how to use
  99. the various features of the TEGL Windows Toolkit.  They are intended for
  100. educational purposes only.  TEGL grants you the right to edit or modify
  101. these game programs for your own use but you may not give away, sell,
  102. repackage, loan, or redistribute them as part of any program, in executable
  103. object or source code form.  You may, however, incorporate miscellaneous
  104. sample program routines into your programs, as long as the resulting
  105. programs do no substantially duplicate all or part of a game program in
  106. appearance or functionality and all copies of all such programs bear a
  107. copyright notice.
  108.  
  109. Limited Warranty:
  110.  
  111. With respect to the physical diskette and physical documentation enclosed
  112. herein TEGL warrants same to be free of defects and materials and
  113. workmanship for a period of one year from the date of purchase.
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122. TEGL will replace defective Software or documentation upon notice within
  123. the warranty period of defects.  Remedy for breach of this warranty shall
  124. be limited to replacement and shall not encompass any other damages,
  125. including, without limitation, loss or business profits, business
  126. interruption, pecuniary loss, and special incidental, consequential, or
  127. other similar claims. This limited warranty is void if failure of the
  128. Software has resulted from accident, abuse, or misapplication.  Any
  129. replacement Software will be warranted for the remainder of the original
  130. warrantly period.
  131.  
  132. TEGL specifically disclaims all other warranties, express, implied, or
  133. statutory, including but not limited to implied warranties of
  134. merchantability and fitness for a particular purpose with respect to the
  135. Software and documentation.  In no event shall TEGL be liable for any loss
  136. of business profit or any other commercial damage including but not limited
  137. to special, incidental, consequential, or other damages.
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.                              Table of Contents
  177.  
  178.                               TABLE OF CONTENTS
  179.  SPECIAL NOTE for documentation on disk..................... 13
  180.  Acknowledgements........................................... 14
  181.  Chapter 1 - Introduction................................... 15
  182.    Why Program with TEGL Windows............................ 15
  183.    The Components of TEGL Windows Toolkit................... 16
  184.    What's On your disks..................................... 16
  185.    Installing TEGL on your system........................... 18
  186.    Development System Recommendations....................... 19
  187.    Compiling with Turbo C................................... 19
  188.    Compiling with Quick C................................... 19
  189.    How to use this Reference Manual......................... 19
  190.       teglsupervisor........................................ 19
  191.    Program Framework........................................ 20
  192.    Frames or Windows?....................................... 21
  193.    How to Contact TEGL Systems Corporation.................. 21
  194.  Chapter 2 - TEGL Easy...................................... 23
  195.    What TEGL Windows Toolkit can do......................... 23
  196.    Event-Driven Code........................................ 23
  197.    Attaching your Function to an Event...................... 24
  198.    Frames................................................... 25
  199.    Menus.................................................... 25
  200.    A Minimum TEGL Program................................... 26
  201.    Adding Menus (Top Down Design)........................... 27
  202.    Adding your First Event.................................. 28
  203.    TEGLEasy................................................. 30
  204.       activebutton.......................................... 30
  205.       coltox................................................ 31
  206.       errmess............................................... 31
  207.       fitframe.............................................. 32
  208.       framefromicon......................................... 32
  209.       frametext............................................. 33
  210.       getmousey............................................. 34
  211.       getyesno.............................................. 35
  212.       easytegl.............................................. 36
  213.       lastcol............................................... 36
  214.       lastrow............................................... 37
  215.       outframetextxy........................................ 38
  216.       quit.................................................. 38
  217.       quickframe............................................ 39
  218.       restoretext........................................... 39
  219.       rowtoy................................................ 40
  220.       selecteasytext........................................ 40
  221.       seteasyfont........................................... 41
  222.  Chapter 3 - Icons.......................................... 42
  223.    The ICON Editor.......................................... 42
  224.       The Main Bar Menu..................................... 42
  225.       Editing............................................... 42
  226.       The Drawing Bar Menu.................................. 42
  227.    ICON Constants........................................... 45
  228.  
  229.  Programmer's Reference Guide       - 4 -         TEGL Windows Toolkit
  230.  
  231.  
  232.  
  233.  
  234.  
  235.                              Table of Contents
  236.  
  237.       putpict............................................... 45
  238.    ICON Assembler Functions................................. 46
  239.    ICON Utilities........................................... 46
  240.       ICONDEF............................................... 46
  241.       ICONLIB............................................... 46
  242.       ICONINC............................................... 47
  243.       ICONASM............................................... 47
  244.    ICONS in TEGLIcon module................................. 47
  245.  Chapter 4 - Frames......................................... 49
  246.    Creating, Manipulating, and Dropping Frames.............. 49
  247.       countframes........................................... 49
  248.       frameexist............................................ 49
  249.       pushimage............................................. 50
  250.       popimage.............................................. 51
  251.       rotatestackimage...................................... 52
  252.       rotateunderstackimage................................. 53
  253.       dropstackimage........................................ 54
  254.       hideimage............................................. 56
  255.       showimage............................................. 57
  256.       showcoordinates....................................... 58
  257.    Preparing a Frame for Update............................. 58
  258.       prepareforpartialupdate............................... 58
  259.       prepareforupdate...................................... 60
  260.       commitupdate.......................................... 61
  261.    Moving a Frame........................................... 62
  262.       frameselectandmove.................................... 63
  263.       setautorotate......................................... 64
  264.       setmoverestrictions................................... 65
  265.       setframemobility...................................... 66
  266.       setmoveframecallproc.................................. 67
  267.       movestackimage........................................ 68
  268.       moveframe............................................. 70
  269.    Low Level Frame Functions................................ 70
  270.       unlinkfs.............................................. 70
  271.       linkfs................................................ 72
  272.       linkunderfs........................................... 73
  273.       createimagebuffer..................................... 74
  274.       dropimagebuffer....................................... 75
  275.       getfsimage............................................ 76
  276.       putfsimage............................................ 76
  277.       freeimagebuffer....................................... 77
  278.       getpartialfrontimage.................................. 78
  279.       getfrontimage......................................... 78
  280.       pageinfs.............................................. 79
  281.       lockimage............................................. 79
  282.       pageoutfs............................................. 80
  283.       setimagecoordinates................................... 81
  284.       pageoutimagestack..................................... 81
  285.       unlockimage........................................... 82
  286.       unuseimage............................................ 82
  287.  
  288.  Programmer's Reference Guide       - 5 -         TEGL Windows Toolkit
  289.  
  290.  
  291.  
  292.  
  293.  
  294.                              Table of Contents
  295.  
  296.       useimage.............................................. 83
  297.    Mouse Click Areas........................................ 84
  298.       definemouseclickarea.................................. 84
  299.       findmouseclickptr..................................... 85
  300.       resetmsclickactive.................................... 87
  301.       resetmsclickcallproc.................................. 87
  302.       resetmouseclicks...................................... 88
  303.       resetmsclicksense..................................... 89
  304.    Keyboard................................................. 90
  305.       clearkeyboardbuf...................................... 90
  306.       clearteglkeyboardbuf.................................. 90
  307.       defineglobalkeyclickarea.............................. 91
  308.       definelocalkeyclickarea............................... 92
  309.       dropkeyclick.......................................... 92
  310.       findkeyclickptr....................................... 93
  311.       resetkeyclickcallproc................................. 93
  312.  Chapter 5 - Menus.......................................... 94
  313.    Creating a Menu.......................................... 94
  314.    Creating a entry text list............................... 94
  315.       createoptionmenu...................................... 96
  316.       defineoptions......................................... 97
  317.       createshadowom........................................ 98
  318.       resizeoptionmenu...................................... 99
  319.       togglecheckmark.......................................100
  320.       toggleentrystatus.....................................101
  321.       replaceoptiontext.....................................102
  322.       toggleoptionbar.......................................103
  323.       setoptionmenucolors...................................103
  324.       setoptionmenubordercolor..............................104
  325.       sethidesubmenu........................................104
  326.    Creating a Bar Menu......................................105
  327.       createbarmenu.........................................105
  328.       outbaroption..........................................106
  329.       setbartextcolor.......................................107
  330.       setbarmenucolor.......................................107
  331.       setbarbordercolor.....................................108
  332.       setbarborderoff.......................................108
  333.       setbarshadowtext......................................108
  334.       setbarfillstyle.......................................109
  335.       setbarmenumargin......................................109
  336.    Icon Option Menus........................................110
  337.       defineoptionclickarea.................................110
  338.       resetoptionmenuevents.................................111
  339.  Chapter 6 - Mouse, Keyboard and Timer Handlers.............113
  340.    Interrupts...............................................113
  341.       swapteglintroff.......................................113
  342.       swapteglintron........................................114
  343.    Mouse Emulation..........................................114
  344.       mcursoroff............................................114
  345.       mcursoron.............................................115
  346.  
  347.  Programmer's Reference Guide       - 6 -         TEGL Windows Toolkit
  348.  
  349.  
  350.  
  351.  
  352.  
  353.                              Table of Contents
  354.  
  355.       msetpos...............................................115
  356.    Standard Mouse Functions.................................116
  357.       showmouse.............................................116
  358.       hidemouse.............................................116
  359.       setmouseposition......................................116
  360.       cursorshape...........................................117
  361.       setmousehotspot.......................................119
  362.       setmousecolor.........................................119
  363.       mouseposition.........................................119
  364.       getbuttonreleaseinfo..................................120
  365.       getbuttonpressinfo....................................121
  366.       clearbuttoninfo.......................................121
  367.       setmouseminmax........................................122
  368.       frozenmouse...........................................122
  369.       freezemouse...........................................123
  370.       unfreezemouse.........................................124
  371.       setmousesensitivity...................................124
  372.       getmousesensitivity...................................125
  373.       setkeyboardmouse......................................125
  374.       setkbsteps............................................126
  375.       getkbsteps............................................127
  376.    Timer Functions..........................................127
  377.       swaptimerout..........................................127
  378.       swaptimerin...........................................128
  379.       settimerstart.........................................128
  380.       resettimerflag........................................129
  381.       droptimercount........................................129
  382.       timerswtich...........................................129
  383.    Keyboard Interrupt Events................................130
  384.    Keyboard Scan Codes......................................130
  385.       addcapturekey.........................................131
  386.       deletecapturekey......................................132
  387.       teglreadkey...........................................132
  388.       teglkeypressed........................................133
  389.       nilkeycallproc........................................133
  390.    Keyboard Miscellaneous...................................133
  391.       setshiftkeys..........................................134
  392.    Show Button Status.......................................134
  393.       showbuttonstatus......................................134
  394.  Chapter 7 - Assembly Language Graphics.....................136
  395.    Setting Video Modes......................................136
  396.       cga640x200x2..........................................136
  397.       ega640x350x16.........................................137
  398.       herc720x348x2.........................................137
  399.       setvideochoices.......................................138
  400.       svga800x600x16........................................138
  401.       vga640x480x16.........................................138
  402.       videoautodetect.......................................139
  403.       videoid...............................................139
  404.    Graphic Primitives.......................................140
  405.  
  406.  Programmer's Reference Guide       - 7 -         TEGL Windows Toolkit
  407.  
  408.  
  409.  
  410.  
  411.  
  412.                              Table of Contents
  413.  
  414.       fastline..............................................140
  415.       putpixs...............................................141
  416.       getpixs...............................................141
  417.       getbiti...............................................142
  418.       putbiti...............................................142
  419.       bigimagesize..........................................143
  420.       setapage..............................................143
  421.       setvpage..............................................144
  422.       flipapage.............................................144
  423.       flipvpage.............................................145
  424.       videopage.............................................145
  425.    New Graphic Primitives...................................146
  426.       extractpixs...........................................146
  427.       extractimg............................................146
  428.       overlayimg............................................147
  429.       swapbytes.............................................147
  430.    Graphic Derivatives......................................147
  431.       xorcornerbox..........................................148
  432.       xorbox................................................148
  433.    Icon Graphics............................................148
  434.       putpict...............................................149
  435.       pictsize..............................................149
  436.       abort_msg.............................................149
  437.  Chapter 8 - Special Effects................................151
  438.    Screen Backdrop..........................................151
  439.       clearteglscreen.......................................151
  440.       setteglbordershow.....................................152
  441.       setteglbackcolor......................................152
  442.       setteglbordercolor....................................153
  443.       setteglfillpattern procedure..........................154
  444.       setteglfillstyle......................................154
  445.    Creating Shadow Boxes....................................155
  446.       shadowbox.............................................155
  447.       shadowboxtext.........................................156
  448.       setshadowcolor........................................156
  449.       setshadowbordercolor..................................157
  450.       setshadowfillpattern..................................157
  451.       setshadowfillstyle....................................158
  452.    Creating Shadow Text.....................................159
  453.       shadowtext............................................159
  454.       setshadowtexttype.....................................160
  455.       setshadowtextshadow...................................160
  456.       setshadowtexthighlight................................161
  457.       shadowtexthighlightoff................................161
  458.    Other text effects.......................................162
  459.       extendtextxy..........................................162
  460.       shifttextxy...........................................162
  461.    Buttons..................................................163
  462.       definebuttonclick.....................................163
  463.       definelongbuttonclick.................................164
  464.  
  465.  Programmer's Reference Guide       - 8 -         TEGL Windows Toolkit
  466.  
  467.  
  468.  
  469.  
  470.  
  471.                              Table of Contents
  472.  
  473.       defineuserbuttonclick.................................164
  474.       putuserbuttonclick....................................165
  475.    Explosions...............................................165
  476.       collapsetoiconshow....................................165
  477.       collapsetomsclick.....................................166
  478.       explodefromiconhide...................................166
  479.       explodefrommsclick....................................167
  480.    Moving and Transforming XOR Boxes........................167
  481.       movebox...............................................167
  482.       ziptobox..............................................168
  483.       zipfrombox............................................169
  484.    Icon Button..............................................170
  485.       drawlongbutton........................................170
  486.  Chapter 9 - Writing Events.................................171
  487.    Mouse Awareness..........................................171
  488.       findframe.............................................171
  489.       checkmouseclickpos....................................172
  490.       checkformouseselect...................................173
  491.    Special Effects..........................................174
  492.       pressbutton...........................................174
  493.       visualbuttonpress.....................................175
  494.  Chapter 10 - Animation.....................................177
  495.    Animation Overview.......................................177
  496.    Animation Functions......................................180
  497.       origin procedure......................................180
  498.       getorigin.............................................180
  499.       destination...........................................181
  500.       resetframe............................................182
  501.       sequence..............................................182
  502.       resetsequence.........................................183
  503.       addframe..............................................184
  504.       currentframenumber....................................185
  505.       animateinit...........................................185
  506.       animate...............................................186
  507.       animatecomplete.......................................186
  508.    Example Animation........................................186
  509.  Chapter 11 - Writing Text..................................188
  510.    TEGLWrt Variables........................................188
  511.    Bit-mapped Fonts.........................................188
  512.    Creating Your Own Bit-mapped Fonts.......................188
  513.    TEGLWrt Functions and Procedures.........................189
  514.       fmttegltextxy.........................................189
  515.       outtegltextxy.........................................189
  516.       tegltextwidth.........................................190
  517.       teglcharwidth.........................................191
  518.       teglcharheight........................................191
  519.       teglwrtchar...........................................191
  520.       setproportional.......................................192
  521.       setteglfont...........................................192
  522.    Showing ALL Fonts FONTTEST.PAS...........................192
  523.  
  524.  Programmer's Reference Guide       - 9 -         TEGL Windows Toolkit
  525.  
  526.  
  527.  
  528.  
  529.  
  530.                              Table of Contents
  531.  
  532.       fontname..............................................193
  533.       showonefont...........................................193
  534.       showfonts.............................................193
  535.  Chapter 12 - Event Library.................................195
  536.    The File Selector........................................195
  537.       selectafile...........................................195
  538.    String Editing Dialog....................................196
  539.       editstring............................................196
  540.    Mouse Sensitivity Dialogue Window........................196
  541.       setmousesense.........................................197
  542.    Bells & Whistles, Sound Unit.............................197
  543.       asksoundsense.........................................197
  544.       beep..................................................198
  545.       slidebeep.............................................198
  546.       soundswitch...........................................199
  547.  Chapter 13 - Virtual Memory Manager........................200
  548.    Heap Management..........................................200
  549.    The Heap Manager.........................................200
  550.    The TEGL Heap Error Function.............................201
  551.    The TEGL Heap Manager Functions..........................202
  552.       cgetmem...............................................202
  553.       cfreemem..............................................203
  554.    Expanded Memory Manager (EMM)............................203
  555.    Expanded Memory Functions................................204
  556.       emminstalled..........................................204
  557.       emspagesavailable.....................................205
  558.       allocateexpandedmemorypages...........................205
  559.       mapexpandedmemorypages................................206
  560.       getpageframebaseaddress...............................206
  561.       deallocateexpandedmemorypages.........................207
  562.       getversionnumber......................................207
  563.       gethandlecountused....................................208
  564.       getpagesownedbyhandle.................................209
  565.    Expanded Memory Test Program.............................209
  566.    A RAM Disk Driver........................................212
  567.       emsopen...............................................213
  568.       emsseek...............................................214
  569.       emsblockwrite.........................................214
  570.       emsblockread..........................................215
  571.       emsclose..............................................216
  572.    Virtual Disk Heap........................................216
  573.       vdskopenheapfile......................................217
  574.       vemsopenheapfile......................................218
  575.       vdskgetmem............................................219
  576.       vdskfreemem...........................................219
  577.       vdskwriteheapdata.....................................220
  578.       vdskreadheapdata......................................221
  579.       vdskcloseheapfile.....................................221
  580.    The Virtual Heap Error Function..........................222
  581.    The Virtual Memory Manager...............................222
  582.  
  583.  Programmer's Reference Guide       - 10 -         TEGL Windows Toolkit
  584.  
  585.  
  586.  
  587.  
  588.  
  589.                              Table of Contents
  590.  
  591.       useharddisk...........................................223
  592.       MoveFromVirtual procedure.............................223
  593.       movetovirtual.........................................224
  594.       freevirtual...........................................224
  595.       cmaxavail.............................................225
  596.       virtualmemused........................................225
  597.    The Virtual Memory Error Function........................225
  598.    Resolving Fragments......................................226
  599.       reservehugeminimum....................................227
  600.  Chapter 14 - Sizing and Sliders............................228
  601.       defineresizeclickarea.................................228
  602.       defineresizeminmax....................................229
  603.       definesliderarea......................................229
  604.       dropsliders...........................................230
  605.       findsliderfs..........................................230
  606.       resizeframe...........................................231
  607.       selectandmoveframe....................................232
  608.       setslideposition......................................232
  609.  Miscellaneous Functions....................................233
  610.       checkctrlbreak........................................233
  611.       checkctrlbreakfs......................................233
  612.       droptimertick.........................................234
  613.       nilunitproc...........................................234
  614.       overlaparea...........................................235
  615.       settimertick..........................................235
  616.  Graphics Library - tgraph..................................237
  617.       Bar...................................................237
  618.       closegraph............................................238
  619.       detectgraph...........................................238
  620.       getbkcolor............................................238
  621.       getcolor..............................................239
  622.       getfillpattern........................................239
  623.       getgraphmode..........................................240
  624.       getmaxx...............................................240
  625.       getmaxy...............................................240
  626.       gettextsettings.......................................241
  627.       graphresult...........................................241
  628.       imagesize.............................................241
  629.       initgraph.............................................242
  630.       line..................................................242
  631.       outtextxy.............................................243
  632.       rectangle.............................................243
  633.       restorecrtmode........................................243
  634.       setbkcolor............................................244
  635.       setcolor..............................................244
  636.       setfillpattern........................................244
  637.       setfillstyle..........................................245
  638.       settextjustify........................................245
  639.  APPENDICES.................................................246
  640.    Video Buffers............................................246
  641.  
  642.  Programmer's Reference Guide       - 11 -         TEGL Windows Toolkit
  643.  
  644.  
  645.  
  646.  
  647.  
  648.                              Table of Contents
  649.  
  650.    Windows..................................................246
  651.    Frames...................................................246
  652.    A Frame Stack............................................247
  653.    A Simple Window Manager..................................247
  654.    Partial Image Update.....................................249
  655.    Refined Partial Image Update.............................249
  656.    A Refined Partial Image Update Algorithm.................250
  657.    A Quick Run through the algorithm........................252
  658.    TEGL Heap Manager........................................254
  659.    TEGL Upper Heap Manager..................................258
  660.    Combining the best of both Heap Managers (Coexisting)....260
  661.    Conditional Compilation..................................263
  662.  INDEX......................................................264
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  Programmer's Reference Guide       - 12 -         TEGL Windows Toolkit
  702.  
  703.  
  704.  
  705.  
  706.  
  707.                              Table of Contents
  708.  
  709. SPECIAL NOTE for documentation on disk
  710.  
  711. You have received Version II of the TEGL Windows Toolkit for TURBO C. The
  712. documentation that you are reading is supplied on disk. We will have a
  713. printed manual in the near future and it will be somewhat different that
  714. what you are looking at now.
  715.  
  716. Because we wanted everyone to be able to read this manual and be able to
  717. print it out we have not embedded any special control characters in it
  718. with the exception of formfeeds at page breaks.
  719.  
  720. In this manual you will notice that at times there are references to
  721. things like ctrlkey or keydown or something discriptive but somewhat odd.
  722. Please, be imaginative, these will be icons when the manual is printed.
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  Programmer's Reference Guide       - 13 -         TEGL Windows Toolkit
  761.  
  762.  
  763.  
  764.  
  765.  
  766.                            Acknowledgements
  767.  
  768. Acknowledgements
  769. ___________________________________________________________________________
  770.  
  771. In this manual references are made to several products
  772.  
  773.  
  774.      TURBO C and TURBO Assembler are registered trademarks of
  775.      Borland International.
  776.  
  777.      IBM is a registered trademarks of International Business
  778.      Machines Inc.
  779.  
  780.      MS-DOS and Windows are registered trademarks of Microsoft
  781.      Inc.
  782.  
  783.      MacIntosh is a registered trademark of Apple Computer Inc.
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  Programmer's Reference Guide       - 14 -         TEGL Windows Toolkit
  820.  
  821.  
  822.  
  823.  
  824.  
  825.                         Chapter 1 - Introduction
  826.  
  827.  
  828. INTRODUCTION
  829. ___________________________________________________________________________
  830.  
  831. Welcome to the world of GUI (Graphical User Interface) in a DOS
  832. environment. This guide will provide you with the basics (and more) for
  833. getting started with using the TEGL Windows Toolkit.
  834.  
  835. TEGL Windows is a comprehensive GUI toolkit for the simplest to the most
  836. sophisticated system programming projects. In order to exploit all the
  837. advantages of this toolkit, we encourage you to experiment and to try the
  838. examples as listed in this manual. Spending time learning the functions of
  839. TEGL Windows will reward you many times over with a system that
  840. provides a Professional look and feel. The power of TEGL Windows
  841. is limited only by your imagination.
  842.  
  843. Why Program with TEGL Windows
  844.  
  845. Because TEGL Windows Toolkit provides the framework in making programs
  846. easy to use.  In this way, it is similar to several other user interfaces
  847. on the market today, including Apple's Macintosh, Microsoft's Windows and
  848. GEM from Digital Research Incorporated.
  849.  
  850. Programs made with TEGL Windows are easier to use for several reasons,
  851. visual effects of graphics can generally communicate information more
  852. effectively than text. For example, the graphical image of a folder
  853. suggests that it contains documents, drawings, and even other folders.
  854.  
  855. Provided are powerful functions that you can use to build very interactive
  856. applications. By q very interactive, we mean a type of user interface
  857. where a significant portion of the design and development effort goes into
  858. making the program easy to use.
  859.  
  860. TEGL Windows Toolkit is based on event handling. Events consists of
  861. anything from a key getting pressed on the keyboard, to a timer signaling
  862. that some amount of time has elapsed, to a message indicating that the
  863. user has selected a particular item from the menu or has selected an icon.
  864. A particularly useful capability of this is that while the TEGLSupervisor
  865. is waiting for one of these events to occur, you can set the timer to
  866. signal a background task like an internal print spooler. This limited
  867. multitasking capability makes it easier to build very interactive
  868. programs.
  869.  
  870. It's important to note that the TEGL Windows Toolkit supports only a
  871. single application running at any given time. Microsoft's Windows will
  872. support multiple concurrent applications, provided they are q
  873. well-behaved, which means that they don't directly manipulate the
  874. computer's hardware.  Most popular applications, by the way, are not
  875. well-behaved.
  876.  
  877.  
  878.  Programmer's Reference Guide       - 15 -         TEGL Windows Toolkit
  879.  
  880.  
  881.  
  882.  
  883.  
  884.                         Chapter 1 - Introduction
  885.  
  886. TEGL is for a single application, which has the beneficial effect of being
  887. part of the final application code and, on the average, much faster than
  888. programs written for Windows or GEM. TEGL also takes less RAM, requiring
  889. only 50k when all features are used.
  890.  
  891. The Components of TEGL Windows Toolkit
  892.  
  893. Now that you have a rough idea of what the TEGL Windows Toolkit is and how
  894. it relates to other alternatives in the microcomputer software marketplace,
  895.  let's explore its' components n more detail. The purpose of this section
  896. is to give you an overall understanding of how to use the toolkit in your
  897. program.
  898.  
  899. TEGL is subdivided into a set of libraries; multitasking kernel; windowing
  900. screen manager; mouse, keyboard and timer handler; a virtual heap manager;
  901. drop down and pop-up menu events; and an animation unit.
  902.  
  903. One of the original goals of TEGL was to provide a graphical user
  904. interface (GUI) to a computer running under DOS. This interface is used in
  905. a number of entertainment products produced by TEGL Systems Corporation
  906. (TSC). As TSC designed and built the entertainment products, TEGL was
  907. created to build a set of software routines that were needed by the games.
  908. TSC gathered these routines into modules, each categorized by their
  909. overall function. For instance, all the routines that manipulate windows
  910. are collected and form the TEGLUnit. Similarly, all the drop-down menus
  911. and menu bars form TEGLMenu.
  912.  
  913. TEGL Windows Toolkit is the tools that were developed in writing these
  914. first entertainment applications. These tools are now available for
  915. developing any application
  916.  
  917. The modules are categorized by the kind of functions they deliver;
  918. TEGLintr handles the mouse, keyboard and timer interrupts; TEGLMenu
  919. provides drop down menus and menu bars; Animate provides icon animation;
  920. and VIRTMem provides the virtual heap for almost unlimited windowing
  921. ability.
  922.  
  923. TEGLUnit provides a high level integration between window frames,
  924. mouse click areas, keyboard handler, timer interrupts, virtual memory, and
  925. multitasking kernel.
  926.  
  927. What's On your disks
  928.  
  929. For your reference, here's a summary of most of the files on the
  930. distribution disks:
  931.  
  932.  
  933. README.TXT
  934.                    This file contains any last-minute notes and
  935.                    corrections, type README at the system prompt to
  936.  
  937.  Programmer's Reference Guide       - 16 -         TEGL Windows Toolkit
  938.  
  939.  
  940.  
  941.  
  942.  
  943.                         Chapter 1 - Introduction
  944.  
  945.                    view the file. You may print this file on your printer
  946.                    for future reference, once you review the material.
  947.  
  948. TEGLSYS.H, TEGLSYS.LIB
  949.                    The header file and library for the toolkit. This is all
  950.                    you need to start programming.
  951.  
  952. TEGLUNIT.C
  953.                    This is the window manager that provides the graphical
  954.                    interface support for the other modules. This module
  955.                    provides the event supervisor and the frame/stack
  956.                    coordinator.
  957.  
  958. TEGLMENU.C
  959.                    This unit provides the drop down menu interface.
  960.  
  961. TEGLGRPH.C
  962.                    Module that provides shadow boxes, shadow texts,
  963.                    exploding and imploding boxes, pop-down/pop-up icon
  964.                    buttons, etc..
  965.  
  966. TEGLICON.C
  967.                    A library of standard icons; key OK, key CANCEL,
  968.                    key NEXT, key LAST.
  969.  
  970. TEGLINTR.C MOUSEASM.ASM
  971.                    Integration of keyboard and mouse handler.  This unit
  972.                    provides the standard mouse routines which integrates
  973.                    the keyboard cursor keys and the mouse to provide a
  974.                    seamless dual control of the mouse cursor; with or
  975.                    without a mouse driver.
  976.  
  977. FASTGRPH.C EGAGRAPH.ASM
  978.                    Fast assembly language graphics routines. This is the
  979.                    core of the graphical routines that provide the
  980.                    foundation for pop-down menus and movable windows.
  981.                    This module includes functions that interface with the
  982.                    ANIMATE unit, to allow the recognition of video paging.
  983.  
  984. TEGLWRT.C WRTASM.ASM
  985.                    Crisp proportional Bit-Mapped screen fonts, ranging
  986.                    from 6 to 24 pixels in height.
  987.  
  988. VIRTMEM.C FREEOPEN.ASM
  989.                    Virtual Memory handler that interfaces with TEGLUNIT.
  990.                    This unit automatically pages out images from memory to
  991.                    EMS, hard disk, or floppy (depending on availability),
  992.                    when memory is at a premium.
  993.  
  994. SELECTFL.C
  995.  
  996.  Programmer's Reference Guide       - 17 -         TEGL Windows Toolkit
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.                         Chapter 1 - Introduction
  1003.  
  1004.                    A standard event unit that may be used by any
  1005.                    application program to provide a dialogue window in
  1006.                    selecting filenames from a list of file on disk.
  1007.  
  1008. SENSEMS.C
  1009.                    A standard event unit that provides a dialogue window
  1010.                    that allows a user to adjust the sensitivity of a
  1011.                    mouse.
  1012.  
  1013. SOUNDUNT.C
  1014.                    A standard event unit that allows a user to adjust the
  1015.                    duration and the sound output of a tone.
  1016.  
  1017. ANIMATE.C
  1018.                    Unit that allows icons to be animated.
  1019. TEGL.C, TEGL.PRJ
  1020.                    A demonstration program that uses most of the features
  1021.                    of the TEGL Windows Toolkit II.
  1022.  
  1023. FONTTEST.C
  1024.                    A demonstration event unit that displays all available
  1025.                    fonts in movable windows. Used in tegl.pas (sample
  1026.                    program).
  1027. DEBUGUNT.C
  1028.                    A demonstration event unit that displays general
  1029.                    information regarding windows and the number of times
  1030.                    the mouse button has been pressed.
  1031. FONTASM.ZIP
  1032.                    A library of bitmapped fonts in Turbo Assembler format.
  1033.                    The source may be modified to create a new font.
  1034. ICONEDIT.C, ICON*.*
  1035.                    The Icon Editor, written using the TEGL Window Toolkit,
  1036.                    to design and generate icons to include in your TEGL
  1037.                    application. ICONASM, ICONDEF, ICONINC and ICONLIB are
  1038.                    standalone programs that will assist you in generating
  1039.                    various formats that you can use to add icons to your
  1040.                    program. A number of standard icons have been created to
  1041.                    include immediately into your application.
  1042. SAM*.C, SAM*.PRJ
  1043.                    Some of the  sample programs in this guide are provided
  1044.                    in ready-to-compile form.
  1045.  
  1046. MAKEFILE.MAK
  1047.                    The make file for compiling the library.
  1048.  
  1049.  
  1050. Installing TEGL on your system
  1051. The complete TEGL Toolkit is approximately 3 megabytes of source code,
  1052. when expanded. A hard disk is required for the installation. It may be
  1053. possible to compile on floppy, but we haven't tried it.
  1054.  
  1055.  Programmer's Reference Guide       - 18 -         TEGL Windows Toolkit
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.                         Chapter 1 - Introduction
  1062.  
  1063.  
  1064. At the DOS prompt, type INSTALL, and follow the instructions.
  1065.  
  1066. Development System Recommendations
  1067. You must have 640k RAM, a hard disk drive, and an EGA/VGA graphics card
  1068. with 256k memory and EGA/VGA color monitor on an IBM PC or compatible
  1069. computer. In our development, we've used an IBM PC AT with 2.5MB RAM, 72MB
  1070. hard disk, and a paradise VGA 256k card with a NEC/MultiSync 3D. We've
  1071. also tested all our examples on an IBM PC XT with 640k RAM, a 20MB hard
  1072. disk, and a ATI VIP VGA graphics adapter card with an IBM 8513 VGA color
  1073. monitor.
  1074.  
  1075. Compiling with Turbo C
  1076.  
  1077. TEGL Windows Toolkit requires Borland's Turbo C Version 2.0, and Turbo
  1078. Assembler to compile all the units. Turbo Assembler is only needed if you
  1079. make the library (which is not necessary). Only Turbo C is required to
  1080. compile programs.
  1081.  
  1082. Refer to the Turbo C Reference Manual for including headers and using
  1083. libraries within programs, as well as setting up the environment and
  1084. creating project files.
  1085.  
  1086.  
  1087. Compiling with Quick C
  1088.  
  1089. TEGL Windows Toolkit requires Microsoft Quick C Version 2.0. The graphics
  1090. functions provided in graphics.lib can be used. See the Appendix
  1091. Conditional Compilation to best determine your requirements.
  1092.  
  1093. How to use this Reference Manual
  1094.  
  1095. This manual is organized in a presentation manner to lead you through the
  1096. concepts of the TEGL Windows Toolkit II.
  1097.  
  1098. Each Function is shown seperately with its name, parameter list, and other
  1099. references. All functions are prototyped in "teglsys.h". For a start here
  1100. is the main entry point into the TEGL Windows Toolkit II.
  1101.  
  1102.  
  1103. ___________________________________________________________________________
  1104.  
  1105. teglsupervisor                                                             
  1106. ___________________________________________________________________________
  1107.  
  1108.  
  1109.  
  1110. Function
  1111.                    Main entry point.
  1112. Syntax
  1113.  
  1114.  Programmer's Reference Guide       - 19 -         TEGL Windows Toolkit
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.                         Chapter 1 - Introduction
  1121.  
  1122.                    void teglsupervisor(void); 
  1123. Remarks
  1124.                    This should be the last statement in main.
  1125. Example
  1126.  
  1127.  
  1128. void main()
  1129.   {
  1130.     /* all the setup code for menus etc. goes first */
  1131.  
  1132.     teglsupervisor();
  1133.   }
  1134.  
  1135.  
  1136.  
  1137.  
  1138. Program Framework
  1139.  
  1140. Most of the examples presented throughout this manual will require the
  1141. following minimal skeletal C framework before the example code will
  1142. compile and execute. A few of the examples given are complete programs.
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148. /*  samshell.c  */
  1149. /*  the minimum requirements for a program */
  1150. /*  using TEGL Windows Toolkit II */
  1151.  
  1152. #include <graphics.h>
  1153. #include "teglsys.h"
  1154.  
  1155. void main()
  1156.   {
  1157.     easytegl();
  1158.  
  1159.     /* insert your code here */
  1160.  
  1161.  
  1162.  
  1163.     /* then turn control over to the supervisor */
  1164.     /* use cntrl-break to exit a program that */
  1165.     /* doesn't have a specific break out point. */
  1166.  
  1167.     teglsupervisor();
  1168.   }
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  Programmer's Reference Guide       - 20 -         TEGL Windows Toolkit
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.                         Chapter 1 - Introduction
  1180.  
  1181.  
  1182. Once control has been turned over to the supervisor then the only way to
  1183. exit a program is by a menu selection or icon that halts the program. Many
  1184. of the example programs don't have this so you must press Ctrl-Break to
  1185. exit. When Ctrl-Break is pressed then program control is turned over to
  1186. an Event Handler. In the case of the sample programs control is passed to
  1187. quit in tegleasy.
  1188.  
  1189. An Event Handler, as covered in Chapter 4, is usually attached to an icon,
  1190. menu selection, or in this case the Ctrl-Break handler. The Ctrl-Break
  1191. handler, when attached to an exit event, allows the program to exit
  1192. gracefully by pressing ctrlkey scrlock which is the break key on
  1193. most keyboards.
  1194.  
  1195. Chapter 2 provides a foundation to using the TEGL Windows Toolkit by using
  1196. a few program examples.  Chapter 3 shows you how to create an icon using
  1197. the icon editor, and how to integrate and use the icons in your program.
  1198. Chapter 4 is heart of the windowing system, which uses most of the
  1199. functions provided by the other modules.  In Chapter 5 we delve further
  1200. into how the teglmenu works along with teglunit to provide the
  1201. standard drop-down menus and exploding windows.  In Chapters 6 through 8,
  1202. we discuss some of the graphic and mouse primitives that the teglunit
  1203. uses.  You may use some of these routines independently of TEGL Windows
  1204. Toolkit.  In Chapter 10 we explore animate along with a sample
  1205. application that animates a button icon.  Chapter 11 looks at writing text
  1206. to a window using bit-mapped fonts.  Chapter 12 provides an overview of the
  1207. standard event library like selecting a file and setting the mouse
  1208. sensitivity.  In Chapter 13, we look at the Virtual Memory handler and how
  1209. to use VM within an application.  Finally, in Chapter 14 and 15, we look at
  1210. re-sizing, slider bars and anything else that we may have missed.
  1211. Appendices provide greater details on the TEGL Windows Toolkit and the
  1212. philosophy behind the design.
  1213.  
  1214. Frames or Windows?
  1215.  
  1216. In this manual the word frame is used often. A frame is our term for
  1217. the implementation of a window. All the identifiers in the toolkit use
  1218. frame, not window. You can use these terms interchangeably.
  1219.  
  1220. How to Contact TEGL Systems Corporation
  1221. If you have any comments or suggestions, you may contact us by
  1222. writing to
  1223.  
  1224.                           TEGL Systems Corporation
  1225.                         780 - 789 West Pender Street
  1226.                          Vancouver, British Columbia
  1227.                                Canada, V6C 1H2
  1228.  
  1229. or phone us at
  1230.  
  1231.  
  1232.  Programmer's Reference Guide       - 21 -         TEGL Windows Toolkit
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.                         Chapter 1 - Introduction
  1239.  
  1240.                                (604) 669-2577
  1241.  
  1242. or facsimile us at
  1243.  
  1244.                                (604) 688-9530
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  Programmer's Reference Guide       - 22 -         TEGL Windows Toolkit
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.                          Chapter 2 - TEGL Easy
  1298.  
  1299. TEGL Easy
  1300. ___________________________________________________________________________
  1301.  
  1302. The TEGL Windows Toolkit provides tools to assist you in creating an
  1303. eye-appealing, functional and intuitive graphical interface to your
  1304. programs.
  1305.  
  1306. There is no fixed format that you must follow when using the TEGL Windows
  1307. Toolkit. Screen handling, menus, or push button icons are a function of
  1308. your program design and not a mandatory function of the TEGL Windows
  1309. Toolkit.  However, the tools are provided so you can use emulate the 
  1310. look and feel of most popular windowing packages without locking you
  1311. into a ridged menu system.
  1312.  
  1313. What TEGL Windows Toolkit can do
  1314.  
  1315. Overlapping windows are handled without having the application program
  1316. redraw the window whenever that window is uncovered. This removes the
  1317. complexity of having to redraw, which is necessary with some windowing
  1318. systems. The only time a window has to be redrawn is when it is re-sized.
  1319.  
  1320. The overhead in maintaining graphic images in memory is offset by the
  1321. virtual memory manager which automatically swaps the images to EMS and/or
  1322. disk when more memory is needed. Even with memory swapping, application
  1323. programs are faster and smaller than those written for other windowing
  1324. environments.
  1325.  
  1326. TEGL Windows handles all mouse and keyboard activities, including all
  1327. selections of a menu items and  clicks on a mouse click area. When the
  1328. user wants to move a window for instance, the teglsupervisor handles
  1329. all of the user interaction from the clicks of the right mouse button on a
  1330. window to when the button is released to indicate the new position. When
  1331. the button is released, and moveframecallproc has been installed for
  1332. that window, the teglupervisor will call your application procedure
  1333. with the new location. Your application can either move the frame by
  1334. calling movestackimage or not do so, depending on whatever it
  1335. determines is appropriate.
  1336.  
  1337.  
  1338. Event-Driven Code
  1339.  
  1340. While it is possible to write your application in a serial manner using
  1341. TEGL Windows by polling the keyboard to see if a key has been pressed, or
  1342. checking the mouse if the mouse has been clicked on an icon or menu, it is
  1343. much more efficient to write using Event-Driven programming.
  1344. Event-driven programming is a style of building programs that makes for
  1345. extremely interactive applications.
  1346.  
  1347. An event is simply the automatic calling of one of your application's
  1348. functions that is triggered by an action such as the mouse cursor
  1349.  
  1350.  Programmer's Reference Guide       - 23 -         TEGL Windows Toolkit
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.                          Chapter 2 - TEGL Easy
  1357.  
  1358. overlapping with an icon on the screen. This type of event handling
  1359. removes the complex checking of keyboards and mouse devices from the
  1360. central program and allows for an almost parallel (multitasking) type of
  1361. program to be created.
  1362.  
  1363. Your choice in programming will determine whether your program responds to
  1364. the user in a sequential mode where one action must be completed before
  1365. proceeding to the next, or multiple activities that may be completed at
  1366. the user's leisure.
  1367.  
  1368. A good example of multiple event handling is a program that simulates a
  1369. calculator. Each key of the calculator pad is tied together with a 
  1370. Mouse Click Area event-handler (ie. a C function) that handles that
  1371. particular key.  With the selection of one of the numeric icon keys, the
  1372. supervisor activates the appropriate event-handler which either adds,
  1373. multiplies, subtracts, or divides the digits. On completion of the
  1374. event-handler's task, the control is returned back to the supervisor to
  1375. await for other events.  Other event-handlers, such as notepads, will
  1376. continue to respond to keyboard or mouse actions along with the activities
  1377. on the calculator.
  1378.  
  1379. An Event is a powerful concept. Hypertext on the MacIntosh is based on a
  1380. similar structure. By associating an event with a word, image, or icon,
  1381. you can chain a series of events together. One event may lead to
  1382. another?
  1383.  
  1384. The number of icon/events that can be created is limited only by available
  1385. memory.
  1386.  
  1387.  
  1388. Attaching your Function to an Event
  1389.  
  1390. There are six (6) basic types of events that the teglsupervisor
  1391. recognizes. The following will provide a brief discussion on event
  1392. handling.
  1393.  
  1394.  
  1395. {bo Mouse Click Area}
  1396.  
  1397. This event occurs whenever the mouse cursor overlaps a defined mouse click
  1398. area on the screen.  Depending on the activation sense, the supervisor may
  1399. call the event-handler only if the left button is clicked (activation
  1400. sense set to msclick), or if the mouse cursor passes over the defined
  1401. mouse click area (activation sense set to mssense). The most common
  1402. use of a mouse click area is the association of an icon with an
  1403. event-handler.
  1404.  
  1405. {bo Click and Drag}
  1406.  
  1407. This event is associated with the movement of a window. Control is passed
  1408.  
  1409.  Programmer's Reference Guide       - 24 -         TEGL Windows Toolkit
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.                          Chapter 2 - TEGL Easy
  1416.  
  1417. to the Event-handler after a new frame position has been selected. One use
  1418. of this type of event processing is the dragging of an icon-frame to the
  1419. trash can (like the MacIntosh).
  1420.  
  1421. {bo Expand and Shrink}
  1422.  
  1423. This event is associated with the sizing of a window. Control is passed to
  1424. the Event-handler after a new frame size has been selected. We use this
  1425. type of event to re-size a window.
  1426.  
  1427. {bo Keyboard Events}
  1428.  
  1429. To accommodate systems without a mouse. The Keyboard Event allows you to
  1430. tie the keyboard to any normal mouse-click-area event handler.
  1431.  
  1432. {bo Timer Ticks}
  1433.  
  1434. The PC has an internal timer that interrupts the activities of any running
  1435. program 18 times a second.  This interruption is transparent to the
  1436. operating system and is used mainly to update the system clock.
  1437.  
  1438. The TEGLunit module uses this timer to provide a flag for the interval of
  1439. timed events. An event-handler may be defined to occur at resolutions up
  1440. to 18 times a second or several hours later.
  1441.  
  1442. {bo Ctrl-Break}
  1443.  
  1444. The Ctrl-Break event is usually tied with the event-handler quit, but,
  1445. like any Event, you may write your own to perform a a different task when
  1446. a Ctrl-Break event occurs.
  1447.  
  1448.  
  1449.  
  1450. Frames
  1451.  
  1452. TEGL Windows Toolkit is a window manager or more correctly a FRAME STACK
  1453. coordinator. A frame is any defined region of the screen.  By stacking two
  1454. or more frames on the screen, the supervisor monitors the location of the
  1455. frames and ensures that each frame retains it's own entity.
  1456.  
  1457. Once a frame is created, the frame area can be cleared and drawn with any
  1458. graphic functions provided by the Turbo C language or any other
  1459. graphical functions provided by other library packages. However, the
  1460. responsibility of drawing within the window is with the program.
  1461.  
  1462. Use the x, y, x1, y1 coordinates provided within the frame struct
  1463. when drawing to the window.
  1464.  
  1465. Menus
  1466.  
  1467.  
  1468.  Programmer's Reference Guide       - 25 -         TEGL Windows Toolkit
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.                          Chapter 2 - TEGL Easy
  1475.  
  1476. The TEGL Menus are actually event-handlers that have been written to
  1477. accommodate drop-down menus, menu selections, lists within a frame, etc.
  1478.  
  1479. The menus require a list of items and related events to be created. The
  1480. list may then be attached to a bar menu using the OutBarOption, which
  1481. is simply a frame with multiple horizontal mouse click defines.
  1482.  
  1483. When teglsupervisor senses the mouse overlapping with one of the bar
  1484. menu selections, an internal baroptionmenu event is called and a
  1485. search is made to find the list that is related to the selection. A menu
  1486. window is then created and displayed using the list. The menu window is
  1487. simply another frame with multiple mouse click defines.
  1488.  
  1489.  
  1490. A Minimum TEGL Program
  1491.  
  1492. The following demo program, prints out the message q Hello World! to a
  1493. small movable window. Note: this one doesn't require the minimum shell
  1494. that we described in the Introduction.
  1495.  
  1496.  
  1497.  
  1498.  
  1499. /*  samc0201.c  */
  1500. /*  the minimum requirements for a program */
  1501. /*  using TEGL Windows Toolkit II */
  1502.  
  1503. #include <graphics.h>
  1504. #include "teglsys.h"
  1505.  
  1506. void main()
  1507.   {
  1508.     easytegl();
  1509.  
  1510.     /* insert your code here */
  1511.  
  1512.     pushimage(100,100,200,120);
  1513.     shadowbox(100,100,200,120);
  1514.     setcolor(BLACK);
  1515.     outtegltextxy(105,105,"Hello world");
  1516.  
  1517.     /* then turn control over to supervisor */
  1518.  
  1519.     teglsupervisor();
  1520.   }
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  Programmer's Reference Guide       - 26 -         TEGL Windows Toolkit
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.                          Chapter 2 - TEGL Easy
  1534.  
  1535.  
  1536.  
  1537. Adding Menus (Top Down Design)
  1538.  
  1539. A powerful feature in programming with TEGL Windows is the ability to
  1540. visually see your application develop. Top down design is a methodology
  1541. where the layout and menu designs are created first and the functional
  1542. aspect of the program created later. Program stubs are used as place
  1543. markers to indicate the required function.
  1544.  
  1545. Adding a drop down menu and connecting the event later is a simple
  1546. task with TEGL Windows.
  1547.  
  1548.  
  1549.  
  1550.  
  1551. /*  samc0202.c  */
  1552.  
  1553. #include <graphics.h>
  1554. #include "teglsys.h"
  1555.  
  1556. optionmptr  om1, om2;
  1557.  
  1558. unsigned getmssense(imagestkptr ifs, msclickptr ms)
  1559.   {
  1560.     setmousesense(ifs->x,ifs->y);
  1561.     return(1);
  1562.   }
  1563.  
  1564. void main()
  1565.   {
  1566.     easytegl();
  1567.  
  1568.     om1 = createoptionmenu(font14);
  1569.     defineoptions(om1," Info... ",TRUE,NULL);
  1570.     defineoptions(om1,"--",     FALSE, NULL);
  1571.     defineoptions(om1," Quit ", TRUE, quit);
  1572.  
  1573.     om2 = createoptionmenu(font14);
  1574.     defineoptions(om2," Memory ",TRUE,showcoordinates);
  1575.     defineoptions(om2," Mouse sensitivity ",TRUE,getmssense);
  1576.  
  1577.     createbarmenu(0,0,getmaxx());
  1578.     outbaroption(" File ",om1);
  1579.     outbaroption(" Utility ",om2);
  1580.  
  1581.  
  1582.     teglsupervisor();
  1583.   }
  1584.  
  1585.  
  1586.  Programmer's Reference Guide       - 27 -         TEGL Windows Toolkit
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.                          Chapter 2 - TEGL Easy
  1593.  
  1594.  
  1595.  
  1596.  
  1597. The event showcoordinates is defined as part of the DebugUnt
  1598. module, setmousesense is defined in SENSEMS, and Quit is
  1599. defined in TEGLEasy.
  1600.  
  1601. Info... is defined to NULL which
  1602. is a program event stub that does nothing.
  1603.  
  1604. Adding events as you go along is easy, now that the menu is set up.
  1605.  
  1606. Adding your First Event
  1607.  
  1608. The following is an event that opens a window and writes a message.
  1609. Notice how we attached infooption as an event to the menu selection
  1610. Info... by replacing NULL with infooption.
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616. /*  samc0203.c  */
  1617.  
  1618. #include <graphics.h>
  1619. #include "teglsys.h"
  1620.  
  1621. optionmptr  om1, om2;
  1622.  
  1623. unsigned infooption(imagestkptr ifs, msclickptr ms)
  1624.   {
  1625.     imagestkptr fs;
  1626.     unsigned x=200,y=120,w=340,h=100;
  1627.  
  1628.     hidemouse();
  1629.     quickframe(&fs,&x,&y,&w,&h);
  1630.  
  1631.     setcolor(BLACK);
  1632.     frametext(fs,1,2,"TEGL Windows Toolkit II");
  1633.     frametext(fs,2,2,"Copyright 1990, TEGL Systems Corporation");
  1634.     frametext(fs,3,2,"All Rights Reserved.");
  1635.     showmouse();
  1636.  
  1637.     return(1);
  1638.   }
  1639.  
  1640. unsigned getmssense(imagestkptr ifs, msclickptr ms)
  1641.   {
  1642.     setmousesense(ifs->x,ifs->y);
  1643.     return(1);
  1644.  
  1645.  Programmer's Reference Guide       - 28 -         TEGL Windows Toolkit
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.                          Chapter 2 - TEGL Easy
  1652.  
  1653.   }
  1654.  
  1655. void main()
  1656.   {
  1657.     easytegl();
  1658.  
  1659.     om1 = createoptionmenu(font14);
  1660.     defineoptions(om1," Info... ",TRUE,infooption);
  1661.     defineoptions(om1,"--",     FALSE, NULL);
  1662.     defineoptions(om1," Quit ", TRUE, quit);
  1663.  
  1664.     om2 = createoptionmenu(font14);
  1665.     defineoptions(om2," Memory ",TRUE,showcoordinates);
  1666.     defineoptions(om2," Mouse sensitivity ",TRUE,getmssense);
  1667.  
  1668.     createbarmenu(0,0,getmaxx());
  1669.     outbaroption(" File ",om1);
  1670.     outbaroption(" Utility ",om2);
  1671.  
  1672.     teglsupervisor();
  1673.   }
  1674.  
  1675.  
  1676.  
  1677.  
  1678. You may notice that the event returns to the TEGLSupervisor leaving
  1679. the window on the screen.
  1680.  
  1681. We can refined this procedure by adding a while loop to wait for the user
  1682. to click on a icon. The getmousey(ifs) function will return once the
  1683. user has selected the OK icon.
  1684.  
  1685. The new event listing.
  1686.  
  1687.  
  1688.  
  1689.  
  1690. unsigned infooption(imagestkptr ifs, msclickptr ms)
  1691.   {
  1692.     imagestkptr fs;
  1693.     unsigned x=200,y=120,w=340,h=100;
  1694.  
  1695.     hidemouse();
  1696.     quickframe(&fs,&x,&y,&w,&h);
  1697.  
  1698.     setcolor(BLACK);
  1699.     frametext(fs,1,2,"TEGL Windows Toolkit II");
  1700.     frametext(fs,2,2,"Copyright 1990, TEGL Systems Corporation");
  1701.     frametext(fs,3,2,"All Rights Reserved.");
  1702.  
  1703.  
  1704.  Programmer's Reference Guide       - 29 -         TEGL Windows Toolkit
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.                          Chapter 2 - TEGL Easy
  1711.  
  1712.     definebuttonclick(fs,x+300,y+70,imageOK,NULL);
  1713.  
  1714.     getmousey(fs);
  1715.  
  1716.     dropstackimage(fs);
  1717.     showmouse();
  1718.  
  1719.     return(1);
  1720.   }
  1721.  
  1722.  
  1723.  
  1724.  
  1725. TEGLEasy
  1726.  
  1727.  
  1728. ___________________________________________________________________________
  1729.  
  1730. activebutton                                                               
  1731. ___________________________________________________________________________
  1732.  
  1733.  
  1734. Function
  1735.                    Makes a button/frame.
  1736. Syntax
  1737.                    void activebutton(unsigned x, unsiged y,
  1738.                      char *s, callproc ); 
  1739. Remarks
  1740.                    This is for creating a button which is attached to a
  1741.                    frame that is the same size as the button. p the
  1742.                    event can then have as the first statement
  1743.                    framefromicon to make a dramatic button to frame
  1744.                    transition.
  1745. Restrictions
  1746.                    if the imagestkptr is required then save the
  1747.                    stackptr immediately after calling activebutton.
  1748. See also
  1749.                    explodefromiconhide, collapsetoiconshow. 
  1750. Example
  1751.  
  1752.  
  1753.   activebutton(100,100,"INFO",infooption);
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759. ___________________________________________________________________________
  1760.  
  1761. coltox                                                                     
  1762.  
  1763.  Programmer's Reference Guide       - 30 -         TEGL Windows Toolkit
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.                          Chapter 2 - TEGL Easy
  1770.  
  1771. ___________________________________________________________________________
  1772.  
  1773.  
  1774. Function
  1775.                    Calculates the X coordinate for a text col.
  1776. Syntax
  1777.                    int coltox(int col); 
  1778. Remarks
  1779.                    This is used to treat the graphics display as if it
  1780.                    were in text mode to make it easy to place a
  1781.                    succession of characters.
  1782. Restrictions
  1783.                    The calculation is made using the currently selected
  1784.                    font.
  1785. See also
  1786.                    rowtoy, setteglfont, seteasyfont.
  1787. Example
  1788.  
  1789.  
  1790.   outtegltextxy(coltox(col)+ifs->x,rowtoy(row)+ifs->y,s);
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796. ___________________________________________________________________________
  1797.  
  1798. errmess                                                                    
  1799. ___________________________________________________________________________
  1800.  
  1801.  
  1802. Function
  1803.                    Display an error message.
  1804. Syntax
  1805.                    void errmess(unsigned x, unsigned y,char *s); 
  1806. Remarks
  1807.                    The error message s is displayed in a frame at
  1808.                    coordinates x,y. The frame is sized to the message
  1809.                    and is adjusted to keep within the confines of the
  1810.                    screen.
  1811.  
  1812.                    The frame is displayed until the 'OK' button in the
  1813.                    lower right corner is clicked.
  1814. See also
  1815.                    getyesno.
  1816. Example
  1817.  
  1818.  
  1819. errmess(100,100,"You must enter a file name first");
  1820.  
  1821.  
  1822.  Programmer's Reference Guide       - 31 -         TEGL Windows Toolkit
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.                          Chapter 2 - TEGL Easy
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834. ___________________________________________________________________________
  1835.  
  1836. fitframe                                                                   
  1837. ___________________________________________________________________________
  1838.  
  1839.  
  1840. Function
  1841.                    Creates coordinates that fit on the physical screen.
  1842. Syntax
  1843.                    void FitFrame(unsigned *x, unsigned *y,
  1844.                      unsigned *width, unsigned *height); 
  1845. Remarks
  1846.                    x,y are the desired upper left coordinates for a
  1847.                    frame. width and height are the desired width
  1848.                    and height in pixels for the frame. If the starting
  1849.                    coordinates would cause the frame to extend beyond the
  1850.                    bounds of the screen then they are decremented until the
  1851.                    frame will fit. If width or height are greater
  1852.                    than their corresponding getmaxx or getmaxy then
  1853.                    they are set to the maximum screen size.
  1854.  
  1855.                    The lower right coordinates are returned in width=x1,
  1856.                    and height=y1.
  1857. See also
  1858.                    quickframe.
  1859. Example
  1860.  
  1861.  
  1862.   unsigned x=639,y=120,w=340,h=100;
  1863.  
  1864.   fitframe(x,y,w,h);      /* adjusted to x=299 */
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870. ___________________________________________________________________________
  1871.  
  1872. framefromicon                                                              
  1873. ___________________________________________________________________________
  1874.  
  1875.  
  1876. Function
  1877.                    Opens a frame in an event that was called from a click
  1878.                    on a icon.
  1879. Syntax
  1880.  
  1881.  Programmer's Reference Guide       - 32 -         TEGL Windows Toolkit
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.                          Chapter 2 - TEGL Easy
  1888.  
  1889.                    void framefromicon(imagestkptr ifs, msclickptr ms,
  1890.                      unsigned x, unsigned y, unsigned x1, unsigned y1); 
  1891. Remarks
  1892.                    This would be the first statement in an event that is
  1893.                    attached to an icon or button created with active
  1894.                    button.
  1895.  
  1896.                    This procedure will hide the icon then display an
  1897.                    exploding wire box from the icon location to the
  1898.                    coordinates x,y,x1,y1 where a frame is opened and
  1899.                    cleared. An OK button is placed in the lower right
  1900.                    corner of the frame and it is attached to
  1901.                    collapsetoiconshow which will close the frame when
  1902.                    it is clicked on.
  1903. See also
  1904.                    activebutton, explodefromiconhide
  1905. Example
  1906.  
  1907.  
  1908. /*  samc0205.c  */
  1909.  
  1910. #include "teglsys.h"
  1911.  
  1912. unsigned easymessage(imagestkptr frame,msclickptr mouseclickpos)
  1913. {
  1914.     framefromicon(frame,mouseclickpos,150,150,400,190);
  1915.     prepareforupdate(stackptr);
  1916.     frametext(stackptr,1,2,"Icon to Frame Transformation");
  1917.     commitupdate();
  1918.  
  1919.     return 1;
  1920. }
  1921.  
  1922. void main()
  1923. {
  1924.     easytegl();
  1925.     activebutton(100,100,"MESSAGE",easymessage);
  1926.     teglsupervisor();
  1927. }
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933. ___________________________________________________________________________
  1934.  
  1935. frametext                                                                  
  1936. ___________________________________________________________________________
  1937.  
  1938.  
  1939.  
  1940.  Programmer's Reference Guide       - 33 -         TEGL Windows Toolkit
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.                          Chapter 2 - TEGL Easy
  1947.  
  1948. Function
  1949.                    Writes text to a frame using row, column coordinates
  1950.                    simulating text mode.
  1951. Syntax
  1952.                    void frametext(imagestkptr ifs, int row, int col,
  1953.                      char *s); 
  1954. Remarks
  1955.                    ifs is the frame to write to. Row and Col
  1956.                    are the row and column locations relative to the frame.
  1957.                    That is, row 1, col 1, is the upper left corner of the
  1958.                    frame. Note the coordinates are the reverse of graphics
  1959.                    coordinates where column comes first.
  1960. Restrictions
  1961.                    The text display is based upon the current font. Swithing
  1962.                    fonts will cause uneven text.
  1963. Example
  1964.  
  1965.  
  1966. /*  samc0206.c  */
  1967.  
  1968. #include "teglsys.h"
  1969.  
  1970. void main()
  1971. {
  1972.     imagestkptr fs;
  1973.     unsigned x=100,y=100,w=200,h=50;
  1974.  
  1975.     easytegl();
  1976.  
  1977.     quickframe(&fs,&x,&y,&w,&h);
  1978.     frametext(fs,2,2,"Hello World!");
  1979.  
  1980.     teglsupervisor();
  1981. }
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987. ___________________________________________________________________________
  1988.  
  1989. getmousey                                                                  
  1990. ___________________________________________________________________________
  1991.  
  1992.  
  1993. Function
  1994.                    Waits for a mouse click and returns the mouse
  1995.                    click number.
  1996. Syntax
  1997.                    unsigned getmousey(imagestkptr ifs) 
  1998.  
  1999.  Programmer's Reference Guide       - 34 -         TEGL Windows Toolkit
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.                          Chapter 2 - TEGL Easy
  2006.  
  2007. Remarks
  2008.                    Mouse clicks numbers are numbered in the order that
  2009.                    you define the mouse click areas.
  2010.  
  2011.                    ifs is the frame where we are waiting for a mouse
  2012.                    click to occur. The mouse click number is returned.
  2013. Example
  2014.  
  2015.  
  2016. definebuttonclick(fs,x+250,y+70,imageOK,NULL);
  2017. definebuttonclick(fs,x+300,y+70,imageCANCEL,NULL);
  2018.  
  2019. switch (getmousey(fs)) {
  2020.    case 1 : /* imageOK was clicked on     */  break;
  2021.    case 2 : /* imageCANCEL was clicked on */  break;
  2022. }
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028. ___________________________________________________________________________
  2029.  
  2030. getyesno                                                                   
  2031. ___________________________________________________________________________
  2032.  
  2033.  
  2034. Function
  2035.                    Gets a yes or no response.
  2036. Syntax
  2037.                    char getyesno(unsigned x,unsigned y, char *s); 
  2038. Remarks
  2039.                    x,y are the coordinates to display the frame. s
  2040.                    is the question to ask, allowing that the only answer
  2041.                    can be Yes or No. The frame has a yes and no
  2042.                    button displayed in the lower right corner.
  2043.  
  2044.                    This function returns a 1 if Yes is clicked and 0
  2045.                    if No is clicked.
  2046. Example
  2047.  
  2048.  
  2049.   if (getyesno(100,100,'Do you want to erase the file'))
  2050.     {
  2051.       /*  erase the file  */
  2052.     }
  2053.   else ; /* cancel the command */
  2054.  
  2055.  
  2056.  
  2057.  
  2058.  Programmer's Reference Guide       - 35 -         TEGL Windows Toolkit
  2059.  
  2060.  
  2061.  
  2062.  
  2063.  
  2064.                          Chapter 2 - TEGL Easy
  2065.  
  2066.  
  2067.  
  2068. ___________________________________________________________________________
  2069.  
  2070. easytegl                                                                   
  2071. ___________________________________________________________________________
  2072.  
  2073.  
  2074. Function
  2075.                    Does a simplified startup for the toolkit.
  2076. Syntax
  2077.                    void easytegl(void); 
  2078. Remarks
  2079.                    This procedure should be called at the very start of
  2080.                    your program. It sets up some default values and clears
  2081.                    the screen.
  2082.  
  2083.                    When you have become familiar with the start-up
  2084.                    requirements of the TEGL Windows Toolkit then you can
  2085.                    write your own initialization procedure.
  2086. Example
  2087.  
  2088.  
  2089. #include "teglsys.h"
  2090.  
  2091. void main()
  2092. {
  2093.     easytegl();
  2094.     teglsupervisor();
  2095. }
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101. ___________________________________________________________________________
  2102.  
  2103. lastcol                                                                    
  2104. ___________________________________________________________________________
  2105.  
  2106.  
  2107. Function
  2108.                    Returns the number or last column of a frame calculated
  2109.                    by the number of text characters that will fit within
  2110.                    a frame.
  2111. Syntax
  2112.                    int lastcol(imagestkptr ifs); 
  2113. Remarks
  2114.                    The calculation is based upon the currently selected
  2115.                    font.
  2116.  
  2117.  Programmer's Reference Guide       - 36 -         TEGL Windows Toolkit
  2118.  
  2119.  
  2120.  
  2121.  
  2122.  
  2123.                          Chapter 2 - TEGL Easy
  2124.  
  2125. Restrictions
  2126.                    Does not allow for BGI fonts.
  2127. See also
  2128.                    lastrow, coltox, rowtoy.
  2129. Example
  2130.  
  2131.  
  2132. imagestkptr fs;
  2133. unsigned x=100,y=100,w=200,h=50;
  2134.  
  2135. lastcol(fs);   /* returns the number of columns that will fit */
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141. ___________________________________________________________________________
  2142.  
  2143. lastrow                                                                    
  2144. ___________________________________________________________________________
  2145.  
  2146.  
  2147. Function
  2148.                    Returns the number or last row of a frame calculated
  2149.                    by the number of text characters rows that will fit
  2150.                    within a frame.
  2151. Syntax
  2152.                    int lastrow(imagestkptr ifs); 
  2153. Remarks
  2154.                    The calculation is based upon the currently selected
  2155.                    font.
  2156. Restrictions
  2157.                    Does not allow for BGI fonts.
  2158. See also
  2159.                    lastcol, coltox, rowtoy.
  2160. Example
  2161.  
  2162.  
  2163. imagestkptr fs;
  2164. unsigned x=100,y=100,w=200,h=50;
  2165.  
  2166. lastrow(fs);   /* returns the number of rows that will fit */
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172. ___________________________________________________________________________
  2173.  
  2174. outframetextxy                                                             
  2175.  
  2176.  Programmer's Reference Guide       - 37 -         TEGL Windows Toolkit
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.                          Chapter 2 - TEGL Easy
  2183.  
  2184. ___________________________________________________________________________
  2185.  
  2186.  
  2187. Function
  2188.                    Writes text to frame using relative coordinates.
  2189. Syntax
  2190.                    void outframetextxy(imagestkptr ifs, unsigned x,
  2191.                      unsigned y, char *s); 
  2192. Remarks
  2193.                    Macro
  2194.                    Uses the currently selected font. Normally, 
  2195.                    outtegltextxy(..) uses screencoordinates to display
  2196.                    your graphic text. Thus you are required to add
  2197.                    ifs->x and ifs->y to your offsets.
  2198.  
  2199.                    outframetextxy expands to add the frame
  2200.                    coordinates to your relative coordinates.
  2201. Restrictions
  2202.                    Does not work with BGI fonts.
  2203. See also
  2204.                    frametext.
  2205. Example
  2206.  
  2207.  
  2208. /* writes "message" at x=5,y=5 pixels from the upper left corner of fs */
  2209. outframetextxy(fs,5,5,"message");
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215. ___________________________________________________________________________
  2216.  
  2217. quit                                                                       
  2218. ___________________________________________________________________________
  2219.  
  2220.  
  2221. Function
  2222.                    Halts program.
  2223. Syntax
  2224.                    unsigned quit(imagestkptr ifs, msclickptr ms); 
  2225. Remarks
  2226.                    Control break is set to this event by default in
  2227.                    easytegl.
  2228.  
  2229.  
  2230.  
  2231. setctrlbreakfs(quit);
  2232.  
  2233.  
  2234.  
  2235.  Programmer's Reference Guide       - 38 -         TEGL Windows Toolkit
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.                          Chapter 2 - TEGL Easy
  2242.  
  2243.  
  2244.  
  2245.  
  2246. ___________________________________________________________________________
  2247.  
  2248. quickframe                                                                 
  2249. ___________________________________________________________________________
  2250.  
  2251.  
  2252. Function
  2253.                    Pushes an image and clears the frame.
  2254. Syntax
  2255.                    void quickframe(imagestkptr *ifs, unsigned *x, unsigned *y,
  2256.                      unsigned *width, unsigned *height); 
  2257. Remarks
  2258.                    x,y are the desired upper left coordinates, width
  2259.                    and height are the size of the frame. Coordinates
  2260.                    are adjusted to fit the physical screen and are returned
  2261.                    in x,y,width,height. The frame struc is also returned
  2262.                    in ifs.
  2263. See also
  2264.                    fitframe.
  2265. Example
  2266.  
  2267.  
  2268.  
  2269.   imagestkptr ifs;
  2270.   int x=100,y=100,w=200,h=150;
  2271.  
  2272.   hidemouse();
  2273.   quickframe(&ifs,&x,&y,&w,&h);
  2274.   frametext(ifs,2,2,"This is too TEGL easy!");
  2275.   showmouse();
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281. ___________________________________________________________________________
  2282.  
  2283. restoretext                                                                
  2284. ___________________________________________________________________________
  2285.  
  2286.  
  2287. Function
  2288.                    Restores the current font.
  2289. Syntax
  2290.                    Macro
  2291.                    void restoretext(void); 
  2292. Remarks
  2293.  
  2294.  Programmer's Reference Guide       - 39 -         TEGL Windows Toolkit
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.                          Chapter 2 - TEGL Easy
  2301.  
  2302.                    the current font is saved when selecteasytext is
  2303.                    called. selecteasytext allows you to temporary
  2304.                    change to another font.
  2305.  
  2306.  
  2307.  
  2308. ___________________________________________________________________________
  2309.  
  2310. rowtoy                                                                     
  2311. ___________________________________________________________________________
  2312.  
  2313.  
  2314. Function
  2315.                    Calculates the Y coordinate for a text row.
  2316. Syntax
  2317.                    int rowtoy(int row); 
  2318. Remarks
  2319.                    This is used to treat the graphics display as if it were
  2320.                    in text mode and make it easier to place succeeding rows
  2321.                    of text on the screen. Returns the pixel offset needed
  2322.                    to add to frame->y to get row.
  2323. Restrictions
  2324.                    The calculation is based on the current font.
  2325. See also
  2326.                    coltox, lastcol, lastrow, frametext
  2327.  
  2328.  
  2329.  
  2330. ___________________________________________________________________________
  2331.  
  2332. selecteasytext                                                             
  2333. ___________________________________________________________________________
  2334.  
  2335.  
  2336. Function
  2337.                    Changes to the font set by seteasyfont
  2338. Syntax
  2339.                    Macro
  2340.                    void selecteasytext(void); 
  2341. Remarks
  2342.                    The font used after this call is selected by previous
  2343.                    call to seteasyfont.
  2344. See also
  2345.                    restoretext.
  2346.  
  2347.  
  2348.  
  2349. ___________________________________________________________________________
  2350.  
  2351. seteasyfont                                                                
  2352.  
  2353.  Programmer's Reference Guide       - 40 -         TEGL Windows Toolkit
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.                          Chapter 2 - TEGL Easy
  2360.  
  2361. ___________________________________________________________________________
  2362.  
  2363.  
  2364. Function
  2365.                    Set the font used by the TEGLEasy Unit.
  2366. Syntax
  2367.                    Macro
  2368.                    void seteasyfont(fontptr p); 
  2369. Remarks
  2370.                    Some of the routines in TEGLEasy write to the screen.
  2371.                    This font is used by these routines.
  2372. See also
  2373.                    selecteasytext, restoretext
  2374. Example
  2375.  
  2376.  
  2377.   seteasyfont(countdwn);
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389.  
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  Programmer's Reference Guide       - 41 -         TEGL Windows Toolkit
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.                           Chapter 3 - Icons
  2419.  
  2420.  
  2421. ICONS
  2422. ___________________________________________________________________________
  2423.  
  2424. Icons are pictures that represent objects. This Icon image diskdrve
  2425. represents a diskette.
  2426.  
  2427. Icons are the mainstay of GUI's.
  2428.  
  2429. The TEGL
  2430. Windows Toolkit provides the tools that can create and manipulate icons up
  2431. to a 100 x 100 pixels in size. By placing an icon within a window frame,
  2432. they may be attached directly to an TEGL event to provide graphical menu
  2433. selections, animated to provide visual feedback, displayed as graphic
  2434. images like the TEGL Deck of Cards, or used to display a company logo.
  2435.  
  2436. The ICON Editor
  2437.  
  2438. Included in TEGL Windows Toolkit is a powerful icon editor that utilizes
  2439. the full power of the tookit to provide you with fast, flexible and easy
  2440. icon file editing. The source code for the icon editor is also included so
  2441. you can expand and modify it to suit your needs.
  2442.  
  2443. The Main Bar Menu
  2444. Open ICONDEF File
  2445.  
  2446. Opens an existing ICON.DEF file, or creates a new DEF file. To create a
  2447. new DEF file, type in the name of the DEF file in the filename box and
  2448. click on key OK.
  2449.  
  2450. Quit
  2451. Quits the icon editor. NOTE: The icon editor does not prompt you to save
  2452. your files.
  2453.  
  2454.  
  2455. Editing
  2456. The mouse cursor changes to cross-hairs when the cursor enters the icon
  2457. drawing area. Pressing the mouse left button will place a pixel at the
  2458. current coordinates. Pressing the mouse right button will erase the pixel.
  2459. You can hold the mouse left or right button, while moving the mouse to
  2460. draw or erase a series of pixels.
  2461.  
  2462. The drawing bar at the bottom of the drawing area has two functions. Press
  2463. and hold the right mouse button on the drawing bar to drag the drawing
  2464. area to a new location. Click with the left mouse button on the drawing
  2465. bar to select from the drawing menu.
  2466.  
  2467. The Drawing Bar Menu
  2468.  
  2469. SAVE
  2470.  
  2471.  Programmer's Reference Guide       - 42 -         TEGL Windows Toolkit
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.                           Chapter 3 - Icons
  2478.  
  2479.  
  2480. Saves the file with the filename displayed on the drawing bar.
  2481.  
  2482. SAVE AS
  2483.  
  2484. Saves the file with a new filename.
  2485.  
  2486. SAVE AND EXIT ICON FILE
  2487. Saves the file with the filename displayed on the drawing bar and closes
  2488. the editing area for the file.
  2489.  
  2490. CREATE C CONSTANTS
  2491. Creates a c constant file with the extension q .CON for including
  2492. in a program.
  2493.  
  2494. COPY IMAGE AREA
  2495.  
  2496. Copies an area into the internal IMAGE AREA. When this option is active a
  2497. scissors icon appears on the drawing bar. Click once with the left mouse
  2498. button to mark the upper left corner of the area to copy. Move the mouse
  2499. cursor to the bottom right corner of the area to copy and click again on
  2500. the left mouse button. When the scissors disappear, the area has been
  2501. copied to the internal IMAGE AREA.
  2502.  
  2503. CUT IMAGE AREA
  2504.  
  2505. Copies an area into an internal IMAGE AREA and clears the Icon area to the
  2506. background color.  When this option is active a scissors icon appears on
  2507. the drawing bar.  Click once with the left mouse button to mark the upper
  2508. left corner of the area to cut.  Move the mouse cursor to the bottom right
  2509. corner of the area and click again on the left mouse button.  When both
  2510. the scissors disappear and the area is cleared, then the area has been
  2511. copied to the internal IMAGE AREA.
  2512.  
  2513. FILL IMAGE AREA
  2514. Fills an area with the current pixel color. Bits that are already set on
  2515. are not overwritten. When this option is active, a coffee mug icon appears
  2516. on the drawing bar.  Click once with the left mouse button to mark the
  2517. upper left corner of the area to fill.  Move the mouse cursor to the
  2518. bottom right corner of the area and click again on the left mouse button.
  2519. The coffee mug disappears when the area is filled with current pixel
  2520. color.
  2521.  
  2522. PASTE IMAGE AREA
  2523.  
  2524. Paste the copied/cut area from the internal IMAGE AREA to the icon drawing
  2525. area. When this option is active, a glue bottle icon appears on the
  2526. drawing bar. Click once at the position where the image is to be pasted.
  2527. The pasted image overwrites any pixels on the drawing area.
  2528.  
  2529.  
  2530.  Programmer's Reference Guide       - 43 -         TEGL Windows Toolkit
  2531.  
  2532.  
  2533.  
  2534.  
  2535.  
  2536.                           Chapter 3 - Icons
  2537.  
  2538. MERGE IMAGE AREA
  2539.  
  2540. Merges the copied/cut area from the internal IMAGE AREA to the icon
  2541. drawing area. When this option is active, a glue bottle icon appears on
  2542. the drawing bar. Click once at the position where the image is to
  2543. be merged. The merged image only writes to empty pixel areas.
  2544.  
  2545. OVERLAY IMAGE AREA
  2546.  
  2547. Overlays the copied/cut area from the internal IMAGE AREA to the icon
  2548. drawing area. When this option is active, a glue bottle icon appears on
  2549. the drawing bar. Click once at the position where the image is to
  2550. be overlayed. The overlay image only writes to active pixels.
  2551.  
  2552. ROTATE IMAGE AREA 45 DEGREES
  2553.  
  2554. Rotates the internal IMAGE AREA by 45 degrees.
  2555.  
  2556. ROTATE IMAGE AREA 90 DEGREES
  2557.  
  2558. Rotates the internal IMAGE AREA by 90 degrees.
  2559.  
  2560. REDUCE IMAGE AREA
  2561.  
  2562. Shrinks the image within the internal IMAGE AREA by 50%. The algorithm
  2563. deletes every second pixel.
  2564.  
  2565. REVERSE IMAGE AREA
  2566.  
  2567. Reverses the image within the internal IMAGE AREA from left to right.
  2568.  
  2569. PIXEL COLOR
  2570.  
  2571. Pick the current pixel color from a palette of 16 colors.
  2572.  
  2573. BACKGROUND COLOR
  2574.  
  2575. Pick the current background color from a palette of 16 colors.
  2576.  
  2577. CHANGE PIXELS COLOR
  2578.  
  2579. Change all pixels with color m to another color n. Where m
  2580. and n are selected from a palette of 16 colors. To cancel the command
  2581. without changing any pixel colors, select the same color for both m
  2582. and n.
  2583.  
  2584. ERASE COLOR PIXELS
  2585.  
  2586. Erases all pixels with the selected pixel color. The color is selected
  2587. from a palette of 16 colors.
  2588.  
  2589.  Programmer's Reference Guide       - 44 -         TEGL Windows Toolkit
  2590.  
  2591.  
  2592.  
  2593.  
  2594.  
  2595.                           Chapter 3 - Icons
  2596.  
  2597.  
  2598. EXPLODE ICON IMAGE
  2599. Enlarges the drawing area. The largest size is a ratio of 3 to 1 (3 pixels
  2600. representing 1 pixel).
  2601.  
  2602. IMPLODE ICON IMAGE
  2603. Shrinks the drawing area.
  2604.  
  2605. CLEAR ICON IMAGE
  2606. Clears the drawing area.
  2607.  
  2608. RELOAD ICON FILE
  2609. Reloads the original icon file.
  2610.  
  2611. EXIT ICON FILE
  2612. Finishes the editing of a icon file.
  2613.  
  2614. You can open as many editing windows at once as you like. The internal
  2615. IMAGE AREA is common to all the edit windows that are open. Consequently,
  2616. whatever is in the internal IMAGE AREA can be pasted to any edit window.
  2617. This allows for the building of icons from small pieces, or copying an
  2618. icon to transform it to something different.
  2619.  
  2620.  
  2621. ICON Constants
  2622.  
  2623. Select from the Drawing Bar Menu CREATE C CONSTANTS, to generate
  2624. constants for including in your program. If you have a large number of
  2625. icons for generating constants, you can use the program ICONINC to
  2626. generate all icons in a one pass.
  2627.  
  2628.  
  2629. ___________________________________________________________________________
  2630.  
  2631. putpict                                                                    
  2632. ___________________________________________________________________________
  2633.  
  2634.  
  2635. Function
  2636.                    Puts the defined icon to the specified screen area.
  2637. Syntax
  2638.                    void putpict(unsigned x,unsigned y,
  2639.                      unsigned char *buf,unsigned n);
  2640. Remarks
  2641.                    x, y defines the upper left corner of the screen
  2642.                    area for placing the icon image.
  2643.  
  2644.                    buf points to the defined icon image.
  2645.  
  2646.                    n defines the color change for any pixel that is
  2647.  
  2648.  Programmer's Reference Guide       - 45 -         TEGL Windows Toolkit
  2649.  
  2650.  
  2651.  
  2652.  
  2653.  
  2654.                           Chapter 3 - Icons
  2655.  
  2656.                    black within the icon.
  2657.  
  2658.  
  2659. ICON Assembler Functions
  2660.  
  2661. The program ICONASM provides a second method that allows you to add
  2662. large icon images to your program (eg. the TEGL Deck of Cards).
  2663.  
  2664. ICONASM generates a C function in assembler. Turbo Assembler is
  2665. required to assemble the file to object code. You may then create an obj
  2666. file that will link the icon function into your C program.
  2667.  
  2668. To display the icon, use the icon function name (your icon name prefixed
  2669. with Image).
  2670.  
  2671.  
  2672.  
  2673.   imageMyIcon(10,25,BLACK);
  2674.  
  2675.  
  2676.  
  2677. Note that these functions are always far.
  2678.  
  2679. ICON Utilities
  2680.  
  2681. ICONDEF
  2682.  
  2683. ICONDEF is a utility program that allows you to strip the .DEF files
  2684. from a turbo C source file, include file or Assembler file, provided
  2685. that the commented /*.. prefix is still a part of your constants.
  2686.  
  2687. Be careful that the Input filename is not the same as one of the
  2688. definition files. Using a suffix other then .DEF will ensure that the
  2689. include file is not overwritten while extracting. However, any filenames
  2690. that do end in .DEF should be copied to a subdirectory if you are not sure
  2691. about the ICON definition names.
  2692.  
  2693.  
  2694.  
  2695.   Syntax:  ICONDEF MYFILE.INC
  2696.  
  2697.   Where:   MYFILE.INC is the include file generated by ICONINC
  2698.            or any file that embeds the include file.
  2699.  
  2700.  
  2701.  
  2702. ICONLIB
  2703.  
  2704. ICONLIB is for assisting the programmer in combining the definition
  2705. files into a single library file for maintenance. Use ICONDEF to extract.
  2706.  
  2707.  Programmer's Reference Guide       - 46 -         TEGL Windows Toolkit
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.                           Chapter 3 - Icons
  2714.  
  2715.  
  2716.  
  2717.  
  2718.   Syntax:  ICONLIB *[.DEF] MYPROG.DLB
  2719.  
  2720.   Where:   *[.DEF] may use any DOS wild-card specifications.
  2721.            MYPROG.DLB may be any library filename.
  2722.  
  2723.  
  2724.  
  2725. ICONINC
  2726. ICONINC  helps the ICON Editor in generating a large number of Turbo
  2727. C ICON constants. Multiple icon definitions may be output to a single
  2728. include file.
  2729.  
  2730.  
  2731.  
  2732.   Syntax:  ICONDEF *[.DEF] MYFILE.INC
  2733.  
  2734.   Where:   *[.DEF] may use any DOS wildcards specifications.
  2735.            MYFILE.INC may be any include filename.
  2736.  
  2737.  
  2738.  
  2739. ICONASM
  2740.  
  2741. ICONASM is for assisting the ICON Editor in generating functions
  2742. from icon definition files. Multiple functions may be output to a single
  2743. asm file.
  2744.  
  2745.  
  2746.  
  2747.   Syntax:  ICONASM *[.DEF] MYPROG.ASM
  2748.  
  2749.   Where:   *[.DEF] may use any DOS wildcards specifications.
  2750.            MYPROG.ASM may be any assembler filename.
  2751.  
  2752.  
  2753.  
  2754. ICONS in TEGLIcon module.
  2755.  
  2756. There are a number of icons that have been created. The following
  2757. are included in the "teglsys.h" file.
  2758.  
  2759.  
  2760. ImageCREDITS
  2761.                    TEGL Windows Toolkit II
  2762. ImageTRASH
  2763.                    A trash can
  2764. ImageOK
  2765.  
  2766.  Programmer's Reference Guide       - 47 -         TEGL Windows Toolkit
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.                           Chapter 3 - Icons
  2773.  
  2774.                    OK button
  2775. ImageCANCEL
  2776.                    Cancel button
  2777. ImageBLANKBUT
  2778.                    A blank button for creating your own
  2779. ImageLBUT ImageMBUT ImageRBUT
  2780.                    Used by DrawLongButon to create an extra long button
  2781.                    icon.
  2782. ImageDOWN
  2783.                    Down arrow.
  2784. ImageUP
  2785.                    Up arrow.
  2786. ImageRIGHT
  2787.                    Right arrow.
  2788. ImageLEFT
  2789.                    Left arrow.
  2790. ImageR
  2791.                    Registered Trademark. reg
  2792. ImageC
  2793.                    Copyright. copyright
  2794. ImageTIGER
  2795.                    A TEGL tiger.
  2796. ImageLAST
  2797.                    Last button.
  2798. ImageNEXT
  2799.                    Next button.
  2800. ImageQUESTION
  2801.                    Question Button.
  2802.  
  2803.  
  2804.  
  2805.  
  2806.  
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  Programmer's Reference Guide       - 48 -         TEGL Windows Toolkit
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.                           Chapter 4 - Frames
  2832.  
  2833. Frames
  2834. ___________________________________________________________________________
  2835.  
  2836. The power and speed of TEGL Windows is most apparent when handling frames.
  2837. By automatically saving and restoring overlapping images, TEGL Windows is
  2838. a very powerful tool for creating the illusion of separate multiple
  2839. windows. Appendix A describes the philosophy behind the TEGL Windows
  2840. Toolkit.
  2841.  
  2842. This chapter provides the basic foundation for creating, manipulating, and
  2843. attaching related items to a frame.
  2844.  
  2845. Creating, Manipulating, and Dropping Frames
  2846.  
  2847.  
  2848. ___________________________________________________________________________
  2849.  
  2850. countframes                                                                
  2851. ___________________________________________________________________________
  2852.  
  2853.  
  2854.  
  2855. Function
  2856.                    Returns the number of frames currently on the
  2857.                    stack.
  2858. Syntax
  2859.                    unsigned countframes(void); 
  2860.  
  2861.  
  2862.  
  2863.  
  2864. ___________________________________________________________________________
  2865.  
  2866. frameexist                                                                 
  2867. ___________________________________________________________________________
  2868.  
  2869.  
  2870.  
  2871. Function
  2872.                    Determines if a frame is on the frame stack.
  2873. Syntax
  2874.                    char frameexist(imagestkptr ifs);
  2875. Remarks
  2876.                    If ifs exists then it contains the address
  2877.                    of one of the frames on the stack.
  2878. Example
  2879.  
  2880.  
  2881.   if frameexist(ifs)
  2882.     dropstackimage(ifs);
  2883.  
  2884.  Programmer's Reference Guide       - 49 -         TEGL Windows Toolkit
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.                           Chapter 4 - Frames
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898. ___________________________________________________________________________
  2899.  
  2900. pushimage                                                                  
  2901. ___________________________________________________________________________
  2902.  
  2903.  
  2904.  
  2905. Function
  2906.                    Used to save the background image before clearing and
  2907.                    drawing new images in this area. Equivalent to opening
  2908.                    a window area.
  2909.  
  2910. Syntax
  2911.                    void pushimage(unsigned x, unsigned y,unsigned x1,
  2912.                                  unsigned y1);
  2913. Remarks
  2914.                    Windows are created by pushing and popping the
  2915.                    background image. x, y, x1, y1 are absolute
  2916.                    coordinates starting with 0,0 at the upper left corner
  2917.                    of the screen to getmaxx, getmaxy at the lower right
  2918.                    corner.
  2919. Restrictions
  2920.                    Saving large images can require a lot of memory even
  2921.                    with the Virtual Memory Manager. If a program is
  2922.                    expected to use most of memory it would be sensible to
  2923.                    include specific checks on memory requirements and
  2924.                    availability before performing a PushImage.
  2925.  
  2926.                    A full screen in EGA mode (640 x 350) requires about
  2927.                    110K of memory, in VGA mode (640 x 480) the requiment
  2928.                    is about 150K.
  2929. See also
  2930.                    popimage, dropstackimage, rotatestackimage,
  2931.                    rotateunderstackimage
  2932. Example
  2933.                    The following will create a shadowed box on the upper
  2934.                    left screen area. Use the right mouse button to drag
  2935.                    the box around.
  2936.  
  2937.  
  2938.  
  2939. /* samc0401.c */
  2940.  
  2941. #include "teglsys.h"
  2942.  
  2943.  Programmer's Reference Guide       - 50 -         TEGL Windows Toolkit
  2944.  
  2945.  
  2946.  
  2947.  
  2948.  
  2949.                           Chapter 4 - Frames
  2950.  
  2951.  
  2952. void main()
  2953.   {
  2954.     easytegl();
  2955.  
  2956.     pushimage(1,1,100,100);
  2957.     shadowbox(1,1,100,100);
  2958.  
  2959.     teglsupervisor();
  2960.   }
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967. ___________________________________________________________________________
  2968.  
  2969. popimage                                                                   
  2970. ___________________________________________________________________________
  2971.  
  2972.  
  2973. Function
  2974.                    Used to restore the top background image after a
  2975.                    PushImage.  Equivalent to closing a window area.
  2976. Syntax
  2977.                    void popimage(void);
  2978. Remarks
  2979.                    Restores the uppermost image area created by (it pushImage.
  2980.  
  2981. See also
  2982.                    pushimage, dropstackimage, rotatestackimage,
  2983.                    rotateunderstackimage
  2984. Example
  2985.                    This example waits until a mouse button is pressed then
  2986.                    calls popimage to restore the background image.
  2987.  
  2988.  
  2989.  
  2990. /* samc0402.c */
  2991.  
  2992. #include "teglsys.h"
  2993.  
  2994. void main()
  2995.   {
  2996.     easytegl();
  2997.  
  2998.     pushimage(1,1,100,100);
  2999.     shadowbox(1,1,100,100);
  3000.     showmouse();
  3001.  
  3002.  Programmer's Reference Guide       - 51 -         TEGL Windows Toolkit
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.                           Chapter 4 - Frames
  3009.  
  3010.  
  3011.     while( mouse_buttons == 0 );
  3012.     popimage();
  3013.  
  3014.     while( mouse_buttons == 0 );
  3015.     abort_msg("");
  3016.  
  3017.   }
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024. ___________________________________________________________________________
  3025.  
  3026. rotatestackimage                                                           
  3027. ___________________________________________________________________________
  3028.  
  3029.  
  3030. Function
  3031.                    Rotates a frame forward or backward relative to the
  3032.                    frames on the screen.
  3033. Syntax
  3034.                    void rotatestackimage(imagestkptr frame1,
  3035.                                  imagestackptr frame2);
  3036. Remarks
  3037.                    Frames may be rotated to the foreground to allow user
  3038.                    input or updates, etc.
  3039.  
  3040.                    A frame may be rotated as the first frame using
  3041.                    rotatestackimage.
  3042.  
  3043.                    In order to access an image that is not the most recent
  3044.                    pushimage you must save the global variable 
  3045.                    stackptr right after the pushimage. the saved
  3046.                    pointer may be used to manipulate the frame.
  3047. Restrictions
  3048.                    A frame can only be rotated above a known frame. To
  3049.                    rotate a frame below another frame on the stack, use
  3050.                    the rotateunderstackimage routine.
  3051. See also
  3052.                    pushimage, popimage, dropstackimage
  3053. Example
  3054.                    The following example creates two overlapping frames
  3055.                    and waits for a click of a mouse button before
  3056.                    rotating the bottom frame to the top.
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  Programmer's Reference Guide       - 52 -         TEGL Windows Toolkit
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.                           Chapter 4 - Frames
  3068.  
  3069. /* samc0403.c */
  3070.  
  3071. #include "teglsys.h"
  3072.  
  3073. void main()
  3074.   {
  3075.     imagestkptr fs;
  3076.  
  3077.     inittegl();
  3078.  
  3079.     pushimage(1,1,100,100);
  3080.     shadowbox(1,1,100,100);
  3081.     fs = stackptr;
  3082.  
  3083.     pushimage(50,50,150,150);
  3084.     shadowbox(50,50,150,150);
  3085.  
  3086.     showmouse();
  3087.  
  3088.     while( mouse_buttons == 0 );
  3089.     rotatestackimage(fs,stackptr);
  3090.  
  3091.     while( mouse_buttons == 0 );
  3092.     abort_msg("");
  3093.  
  3094.   }
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101. ___________________________________________________________________________
  3102.  
  3103. rotateunderstackimage                                                      
  3104. ___________________________________________________________________________
  3105.  
  3106.  
  3107. Function
  3108.                    Rotates a frame forward or backward relative to the
  3109.                    frames on the screen. Rotates a frame below frame2.
  3110. Syntax
  3111.                    void rotateunderstackimage(imagestkptr frame1,
  3112.                                  imagestkptr frame2);
  3113. Remarks
  3114.  
  3115.                    In order to access an image that is not the most recent
  3116.                    pushimage you must save the global variable 
  3117.                    stackptr right after the pushimage. the saved
  3118.                    pointer may be used to manipulate the frame.
  3119.  
  3120.  Programmer's Reference Guide       - 53 -         TEGL Windows Toolkit
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.                           Chapter 4 - Frames
  3127.  
  3128. Restrictions
  3129.                    A frame can only be rotated below a known frame. To
  3130.                    rotate a frame above another frame on the stack, use
  3131.                    the rotatestackimage.
  3132. See also
  3133.                    pushimage, popimage, dropstackimage
  3134. Example
  3135.                    The following example creates two overlapping frames
  3136.                    and awaits for a click of a mouse button before
  3137.                    rotating the Top frame under the second frame.
  3138.  
  3139.  
  3140. /* samc0404.c */
  3141.  
  3142. #include "teglsys.h"
  3143.  
  3144. void main()
  3145.   {
  3146.     imagestkptr fs;
  3147.  
  3148.     easytegl();
  3149.  
  3150.     pushimage(1,1,100,100);
  3151.     shadowbox(1,1,100,100);
  3152.     fs = stackptr;
  3153.  
  3154.     pushimage(50,50,150,150);
  3155.     shadowbox(50,50,150,150);
  3156.  
  3157.     showmouse();
  3158.  
  3159.     while( mouse_buttons == 0 );
  3160.     rotateunderstackimage(stackptr,fs);
  3161.  
  3162.     while( mouse_buttons == 0 );
  3163.     abort_msg("");
  3164.  
  3165.   }
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173. ___________________________________________________________________________
  3174.  
  3175. dropstackimage                                                             
  3176. ___________________________________________________________________________
  3177.  
  3178.  
  3179.  Programmer's Reference Guide       - 54 -         TEGL Windows Toolkit
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.                           Chapter 4 - Frames
  3186.  
  3187.  
  3188. Function
  3189.                    Used to close a frame that is not necessarily the
  3190.                    topmost image on the stack. Equivalent to closing a
  3191.                    window area.
  3192. Syntax
  3193.                    void dropstackimage(imagestkptr frame);
  3194. Remarks
  3195.                    Restores an image area created by pushimage.
  3196.  
  3197.                    In order to access an image that is not the most recent
  3198.                    pushimage you must save the global variable 
  3199.                    stackptr right after the pushimage. The saved
  3200.                    pointer may be used to manipulate the frame.
  3201. See also
  3202.                    pushimage, popimage, rotatestackimage,
  3203.                    rotateunderstackimage
  3204. Example
  3205.                    The following example creates two overlapping frames
  3206.                    and awaits for a click of a mouse button before
  3207.                    dropping the bottom frame from the screen.
  3208.  
  3209.  
  3210. /* samc0405.c */
  3211.  
  3212. #include "teglsys.h"
  3213.  
  3214. void main()
  3215.   {
  3216.     imagestkptr fs;
  3217.  
  3218.     easytegl();
  3219.  
  3220.     pushimage(1,1,100,100);
  3221.     shadowbox(1,1,100,100);
  3222.     fs = stackptr;
  3223.  
  3224.     pushimage(50,50,150,150);
  3225.     shadowbox(50,50,150,150);
  3226.  
  3227.     showmouse();
  3228.  
  3229.     while( mouse_buttons == 0 );
  3230.     dropstackimage(fs);
  3231.  
  3232.     while( mouse_buttons == 0 );
  3233.     abort_msg("");
  3234.  
  3235.   }
  3236.  
  3237.  
  3238.  Programmer's Reference Guide       - 55 -         TEGL Windows Toolkit
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.                           Chapter 4 - Frames
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250.  
  3251.  
  3252. ___________________________________________________________________________
  3253.  
  3254. hideimage                                                                  
  3255. ___________________________________________________________________________
  3256.  
  3257.  
  3258. Function
  3259.                    Hides an Image Frame from the screen but retains the
  3260.                    current stack position and frontal image.
  3261. Syntax
  3262.                    void hideimage(imagestkptr frame);
  3263. Remarks
  3264.                    This procedure may be used in a variety of ways.
  3265.                    Blinking a frame by alternating between hideimage and
  3266.                    showimage. Moving a frame from one location to another.
  3267. See also
  3268.                    showimage
  3269. Example
  3270.                    The following example blinks a frame continuously until
  3271.                    a mouse button is pressed.
  3272.  
  3273.  
  3274.  
  3275. /* samc0406.c */
  3276.  
  3277. #include "teglsys.h"
  3278.  
  3279. void main()
  3280.   {
  3281.     imagestkptr fs;
  3282.     unsigned i;
  3283.  
  3284.     easytegl();
  3285.  
  3286.     pushimage(1,1,50,50);
  3287.     shadowbox(1,1,50,50);
  3288.     fs = stackptr;
  3289.     showmouse();
  3290.  
  3291.     i = 20000;
  3292.  
  3293.     do
  3294.       {
  3295.         --i;
  3296.  
  3297.  Programmer's Reference Guide       - 56 -         TEGL Windows Toolkit
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.                           Chapter 4 - Frames
  3304.  
  3305.         if (i == 10000)
  3306.           hideimage(fs);
  3307.         if (i == 0)
  3308.           {
  3309.              showimage(fs,fs->x,fs->y);
  3310.              i = 20000;
  3311.           }
  3312.         }
  3313.     while( mouse_buttons == 0 );
  3314.     if (i <= 10000)
  3315.       showimage(fs,fs->x,fs->y);
  3316.  
  3317.   }
  3318.  
  3319.  
  3320.  
  3321.  
  3322.  
  3323.  
  3324.  
  3325. ___________________________________________________________________________
  3326.  
  3327. showimage                                                                  
  3328. ___________________________________________________________________________
  3329.  
  3330.  
  3331. Function
  3332.                    Shows a Hidden Image Frame.
  3333. Syntax
  3334.                    void hideimage(imagestkptr frame)
  3335. See also
  3336.                    hideimage
  3337. Example
  3338.                    The following example moves a frame from one location
  3339.                    to another when a mouse button is pressed.
  3340.  
  3341.  
  3342. /* samc0407.c */
  3343.  
  3344. #include "teglsys.h"
  3345.  
  3346. void main()
  3347.   {
  3348.     imagestkptr fs;
  3349.  
  3350.     easytegl();
  3351.  
  3352.     pushimage(1,1,100,100);
  3353.     shadowbox(1,1,100,100);
  3354.     fs = stackptr;
  3355.  
  3356.  Programmer's Reference Guide       - 57 -         TEGL Windows Toolkit
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.                           Chapter 4 - Frames
  3363.  
  3364.  
  3365.     pushimage(50,50,150,150);
  3366.     shadowbox(50,50,150,150);
  3367.     showmouse();
  3368.  
  3369.     while( mouse_buttons == 0 );
  3370.  
  3371.     hideimage(fs);
  3372.     showimage(fs,fs->x+100,fs->y+100);
  3373.  
  3374.     while( mouse_buttons == 0 );
  3375.     abort_msg("");
  3376.  
  3377.   }
  3378.  
  3379.  
  3380.  
  3381.  
  3382.  
  3383.  
  3384.  
  3385. ___________________________________________________________________________
  3386.  
  3387. showcoordinates                                                            
  3388. ___________________________________________________________________________
  3389.  
  3390.  
  3391. Function
  3392.                    An Event that displays the coordinates of a frame.
  3393. Syntax
  3394.                    unsigned showcoordinates(imagestkptr ifs,
  3395.                      msclickptr ms);
  3396. Remarks
  3397.                    This event displays the coordinates of a frame.
  3398.  
  3399.  
  3400. Preparing a Frame for Update
  3401.  
  3402.  
  3403. ___________________________________________________________________________
  3404.  
  3405. prepareforpartialupdate                                                    
  3406. ___________________________________________________________________________
  3407.  
  3408.  
  3409. Function
  3410.                    Prepares a portion of a frame for output. Removes all
  3411.                    overlapping images above the partial area that is being
  3412.                    updated on the screen.
  3413. Syntax
  3414.  
  3415.  Programmer's Reference Guide       - 58 -         TEGL Windows Toolkit
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.                           Chapter 4 - Frames
  3422.  
  3423.                    void prepareforpartialupdate(imagestkptr frame;
  3424.                      unsigned x, unsigned y,unsigned x1, unsigned y1);
  3425. Remarks
  3426.                    x,y,x1,y1 are absolute coordinates starting with 0,0 at
  3427.                    the upper left corner of the screen to getmaxx, getmaxy
  3428.                    at the lower right corner.
  3429. Restrictions
  3430.                    The coordinates must be within the absolute frame
  3431.                    coordinates. Use the current Frame coordinates +
  3432.                    offsets to obtain the correct absolute coordinates.
  3433.  
  3434.                    prepareforpartialupdate and prepareforupdate can
  3435.                    be used on multiple frames (provided the update areas
  3436.                    do not overlap) but must be matched by an equal number
  3437.                    of calls to commitupdate.
  3438. See also
  3439.                    prepareforupdate, commitupdate
  3440. Example
  3441.                    The following example creates two overlapping frames
  3442.                    and awaits for a click of a mouse button before drawing
  3443.                    a circle on the bottom frame.
  3444.  
  3445.  
  3446. /* samc0408.c */
  3447.  
  3448. #include <graphics.h>
  3449. #include "teglsys.h"
  3450.  
  3451.  
  3452. void main()
  3453.   {
  3454.     imagestkptr fs;
  3455.  
  3456.     easytegl();
  3457.  
  3458.     pushimage(1,1,100,100);
  3459.     shadowbox(1,1,100,100);
  3460.     fs = stackptr;
  3461.  
  3462.     pushimage(50,50,150,150);
  3463.     shadowbox(50,50,150,150);
  3464.     showmouse();
  3465.  
  3466.  
  3467.     while( mouse_buttons == 0 );
  3468.  
  3469.     prepareforpartialupdate(fs,fs->x,fs->y,fs->x1,fs->y1);
  3470.     setcolor(BLUE);
  3471.     circle(fs->x+48,fs->y+45,50);
  3472.     commitupdate();
  3473.  
  3474.  Programmer's Reference Guide       - 59 -         TEGL Windows Toolkit
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.                           Chapter 4 - Frames
  3481.  
  3482.  
  3483.  
  3484.     while( mouse_buttons == 0 );
  3485.     abort_msg("");
  3486.  
  3487.   }
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.  
  3494.  
  3495. ___________________________________________________________________________
  3496.  
  3497. prepareforupdate                                                           
  3498. ___________________________________________________________________________
  3499.  
  3500.  
  3501. Function
  3502.                    Prepares a frame for output. Removes all overlapping
  3503.                    images above the frame area that is being updated on
  3504.                    the screen.
  3505. Syntax
  3506.                    void prepareforupdate(imagestkptr frame);
  3507. Remarks
  3508.                    Identical to prepareforpartialupdate, except the
  3509.                    current frame coordinates are passed automatically.
  3510. Restrictions
  3511.                    prepareforpartialupdate and prepareforupdate can
  3512.                    be used on multiple frames (provided the update areas
  3513.                    do not overlap) but must be matched by an equal number
  3514.                    of calls to commitupdate.
  3515. See also
  3516.                    prepareforpartialupdate, commitupdate
  3517. Example
  3518.                    The following example creates two overlapping frames
  3519.                    and awaits for a click of a mouse button before drawing
  3520.                    a circle on the bottom frame.
  3521.  
  3522.  
  3523. /* samc0409.c */
  3524.  
  3525. #include <graphics.h>
  3526. #include "teglsys.h"
  3527.  
  3528.  
  3529. void main()
  3530.   {
  3531.     imagestkptr fs;
  3532.  
  3533.  Programmer's Reference Guide       - 60 -         TEGL Windows Toolkit
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.                           Chapter 4 - Frames
  3540.  
  3541.  
  3542.     easytegl();
  3543.  
  3544.     pushimage(1,1,100,100);
  3545.     shadowbox(1,1,100,100);
  3546.     fs = stackptr;
  3547.  
  3548.     pushimage(50,50,150,150);
  3549.     shadowbox(50,50,150,150);
  3550.     showmouse();
  3551.  
  3552.  
  3553.     while( mouse_buttons == 0 );
  3554.  
  3555.     prepareforupdate(fs);
  3556.     setcolor(BLUE);
  3557.     circle(fs->x+48,fs->y+45,50);
  3558.     commitupdate();
  3559.  
  3560.  
  3561.     while( mouse_buttons == 0 );
  3562.     abort_msg("");
  3563.  
  3564.   }
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.  
  3572. ___________________________________________________________________________
  3573.  
  3574. commitupdate                                                               
  3575. ___________________________________________________________________________
  3576.  
  3577.  
  3578. Function
  3579.                    Commits update. Replaces all overlapping images above
  3580.                    the frame area that was being updated on the screen.
  3581. Syntax
  3582.                    void commitupdate(void);
  3583. Remarks
  3584.                    commitupdate must be used to close the functions
  3585.                    prepareforpartialupdate and prepareforupdate.
  3586. Restrictions
  3587.                    commitupdate must be called an equal number of
  3588.                    times for each prepareforpartialupdate and 
  3589.                    prepareforupdate.
  3590. See also
  3591.  
  3592.  Programmer's Reference Guide       - 61 -         TEGL Windows Toolkit
  3593.  
  3594.  
  3595.  
  3596.  
  3597.  
  3598.                           Chapter 4 - Frames
  3599.  
  3600.                    prepareforpartialupdate, prepareforupdate
  3601. Example
  3602.                    The following example creates two overlapping frames
  3603.                    and awaits for a click of a mouse button before drawing
  3604.                    a circle on the bottom frame.
  3605.  
  3606.  
  3607. /* samc04010.c */
  3608.  
  3609. #include <graphics.h>
  3610. #include "teglsys.h"
  3611.  
  3612.  
  3613. void main()
  3614.   {
  3615.     imagestkptr fs;
  3616.  
  3617.     easytegl();
  3618.  
  3619.     pushimage(1,1,100,100);
  3620.     shadowbox(1,1,100,100);
  3621.     fs = stackptr;
  3622.  
  3623.     pushimage(50,50,150,150);
  3624.     shadowbox(50,50,150,150);
  3625.     showmouse();
  3626.  
  3627.  
  3628.     while( mouse_buttons == 0 );
  3629.  
  3630.     prepareforupdate(fs);
  3631.     setcolor(BLUE);
  3632.     circle(fs->x+48,fs->y+45,50);
  3633.     commitupdate();
  3634.  
  3635.  
  3636.     while( mouse_buttons == 0 );
  3637.     abort_msg("");
  3638.  
  3639.   }
  3640.  
  3641.  
  3642.  
  3643.  
  3644.  
  3645. Moving a Frame
  3646.  
  3647.  
  3648. ___________________________________________________________________________
  3649.  
  3650.  
  3651.  Programmer's Reference Guide       - 62 -         TEGL Windows Toolkit
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657.                           Chapter 4 - Frames
  3658.  
  3659. frameselectandmove                                                         
  3660. ___________________________________________________________________________
  3661.  
  3662.  
  3663. Function
  3664.                    Allows a frame to be moved. This routine is normally
  3665.                    called by the teglsupervisor when the right mouse
  3666.                    button is held down and the mouse cursor is positioned
  3667.                    over a frame.
  3668.  
  3669. Syntax
  3670.                    imagestkptr frameselectandmove(unsigned mxpos,
  3671.                      unsigned mypos);
  3672. Result type
  3673.                    Returns a pointer to the frame that the mouse had
  3674.                    selected and moved.
  3675. Remarks
  3676.                    The movement of the Frame is under the control of the
  3677.                    user until the mouse button is released. To move a
  3678.                    frame under program control, use movestackimage.
  3679.  
  3680. Restrictions
  3681.                    This function returns immediately if neither mouse
  3682.                    button is held down on entry.
  3683.  
  3684. See also
  3685.                    setmoverestrictions, setframemobility,
  3686.                    setmoveframecallproc, movestackimage
  3687. Example
  3688.                    The following example displays a green mouse cursor and
  3689.                    calls frameselectandmove whenever the right mouse
  3690.                    button is pressed. The routine exits and changes the
  3691.                    mouse cursor back to white when the left mouse button
  3692.                    is pressed.
  3693.  
  3694.  
  3695. /* samc04011.c */
  3696.  
  3697. #include <graphics.h>
  3698. #include "teglsys.h"
  3699.  
  3700.  
  3701. void main()
  3702.   {
  3703.     imagestkptr fs;
  3704.  
  3705.     easytegl();
  3706.  
  3707.     pushimage(1,1,100,100);
  3708.     shadowbox(1,1,100,100);
  3709.  
  3710.  Programmer's Reference Guide       - 63 -         TEGL Windows Toolkit
  3711.  
  3712.  
  3713.  
  3714.  
  3715.  
  3716.                           Chapter 4 - Frames
  3717.  
  3718.     fs = stackptr;
  3719.  
  3720.     showmouse();
  3721.     setmousecolor(GREEN);
  3722.  
  3723.     do
  3724.       if (mouse_buttons == 1)
  3725.         fs = frameselectandmove(mouse_xcoord,mouse_ycoord);
  3726.     while( mouse_buttons != 2 );
  3727.  
  3728.     setmousecolor(WHITE);
  3729.  
  3730.   }
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.  
  3737. ___________________________________________________________________________
  3738.  
  3739. setautorotate                                                              
  3740. ___________________________________________________________________________
  3741.  
  3742.  
  3743. Function
  3744.                    Sets the frame stack auto rotate function.
  3745. Syntax
  3746.                    Macro
  3747.                    void setautorotate(char onoff);
  3748. Remarks
  3749.                    Auto rotate is normally set to FALSE. That is, a frame
  3750.                    will not automatically rotate to the top of the stack.
  3751.                    When set to TRUE any frame that is partially covered
  3752.                    will be moved to the top of the stack when
  3753.                    teglsupervisor detects a left mouse button click
  3754.                    anywhere on the frame.
  3755. Example
  3756.  
  3757.  
  3758.  
  3759. /* samc04012.c */
  3760.  
  3761. #include <graphics.h>
  3762. #include "teglsys.h"
  3763.  
  3764.  
  3765. void main()
  3766.   {
  3767.     imagestkptr fs;
  3768.  
  3769.  Programmer's Reference Guide       - 64 -         TEGL Windows Toolkit
  3770.  
  3771.  
  3772.  
  3773.  
  3774.  
  3775.                           Chapter 4 - Frames
  3776.  
  3777.  
  3778.     easytegl();
  3779.  
  3780.     pushimage(1,1,100,100);
  3781.     shadowbox(1,1,100,100);
  3782.     pushimage(50,50,150,150);
  3783.     shadowbox(50,50,150,150);
  3784.  
  3785.     setautorotate(TRUE);
  3786.     showmouse();
  3787.  
  3788.     teglsupervisor();
  3789.  
  3790.   }
  3791.  
  3792.  
  3793.  
  3794.  
  3795.  
  3796.  
  3797.  
  3798. ___________________________________________________________________________
  3799.  
  3800. setmoverestrictions                                                        
  3801. ___________________________________________________________________________
  3802.  
  3803.  
  3804. Function
  3805.                    Sets the minimum and maximum coordinates that a frame
  3806.                    may be moved.
  3807. Syntax
  3808.                    Macro
  3809.                    void setmoverestrictions(imagestkptr frame;
  3810.                      unsigned x, unsigned y, unsigned x1, unsigned y1);
  3811. Remarks
  3812.                    Sets the area that a frame is restricted to when
  3813.                    frameselectandmove is called.
  3814. Restrictions
  3815.                    The restriction does not apply when a frame is moved
  3816.                    using movestackimage.
  3817. See also
  3818.                    frameselectandmove, setframemobility,
  3819.                    setmoveframecallproc, movestackimage
  3820. Example
  3821.                    The following sets the frame mobility to the upper half
  3822.                    of the screen. Use the right mouse button to move the
  3823.                    frame around.
  3824.  
  3825.  
  3826. /* samc04013.c */
  3827.  
  3828.  Programmer's Reference Guide       - 65 -         TEGL Windows Toolkit
  3829.  
  3830.  
  3831.  
  3832.  
  3833.  
  3834.                           Chapter 4 - Frames
  3835.  
  3836.  
  3837. #include <graphics.h>
  3838. #include "teglsys.h"
  3839.  
  3840.  
  3841. void main()
  3842.   {
  3843.  
  3844.     easytegl();
  3845.  
  3846.     pushimage(1,1,100,100);
  3847.     shadowbox(1,1,100,100);
  3848.  
  3849.     setmoverestrictions(stackptr,0,0,getmaxx(),getmaxy() / 2);
  3850.  
  3851.     teglsupervisor();
  3852.  
  3853.   }
  3854.  
  3855.  
  3856.  
  3857.  
  3858.  
  3859.  
  3860.  
  3861.  
  3862. ___________________________________________________________________________
  3863.  
  3864. setframemobility                                                           
  3865. ___________________________________________________________________________
  3866.  
  3867.  
  3868. Function
  3869.                    Toggles the ability for a frame to move.
  3870. Syntax
  3871.                    Macro
  3872.                    void setframemobility(imagestkptr frame, char movable);
  3873. Remarks
  3874.                    When the mobility of a frame is set to off (FALSE), the
  3875.                    frame outline will move when frameselectandmove is
  3876.                    called, however, the frame is not moved to the new
  3877.                    location when the mouse button is released.
  3878.  
  3879.                    The default frame mobility is ON (TRUE).
  3880. Restrictions
  3881.                    The mobility toggle has no effect when a frame is moved
  3882.                    using movestackimage.
  3883. See also
  3884.                    frameselectandmove, setmoverestrictions,
  3885.                    setmoveframecallproc, movestackimage
  3886.  
  3887.  Programmer's Reference Guide       - 66 -         TEGL Windows Toolkit
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.                           Chapter 4 - Frames
  3894.  
  3895. Example
  3896.                    The following example toggles a frames mobility to off.
  3897.  
  3898.  
  3899.  
  3900. /* samc04014.c */
  3901.  
  3902. #include <graphics.h>
  3903. #include "teglsys.h"
  3904.  
  3905.  
  3906. void main()
  3907.   {
  3908.  
  3909.     easytegl();
  3910.  
  3911.     pushimage(1,1,100,100);
  3912.     shadowbox(1,1,100,100);
  3913.  
  3914.     setframemobility(stackptr,FALSE);
  3915.  
  3916.     teglsupervisor();
  3917.  
  3918.   }
  3919.  
  3920.  
  3921.  
  3922.  
  3923.  
  3924.  
  3925.  
  3926. ___________________________________________________________________________
  3927.  
  3928. setmoveframecallproc                                                       
  3929. ___________________________________________________________________________
  3930.  
  3931.  
  3932. Function
  3933.                    An event process that is called after an frame has been
  3934.                    dragged to a new screen position.
  3935. Syntax
  3936.                    Macro
  3937.                    void setmoveframecallproc(imagestkptr frame, callproc p);
  3938. Remarks
  3939.                    Can be used for the trash can effect, originating with
  3940.                    the MacIntosh, by which file icons are dragged to the
  3941.                    trash can to be deleted from the system.
  3942.  
  3943.                    the event may check the mouseclickpos struct (fields
  3944.                    ms.x, ms.y, ms.x1, and ms.y1) for the new frame
  3945.  
  3946.  Programmer's Reference Guide       - 67 -         TEGL Windows Toolkit
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.                           Chapter 4 - Frames
  3953.  
  3954.                    location and whether they overlap the desired frame.
  3955. Restrictions
  3956.                    If you wish for the frame to move to the new location,
  3957.                    the event must call movestackimage before returning.
  3958. See also
  3959.                    frameselectandmove, setmoverestrictions,
  3960.                    setframemobility, movestackimage
  3961. Example
  3962.                    The following is a very simple Event Handler that
  3963.                    simply closes the frame if the frame is moved.
  3964.  
  3965.  
  3966. /* samc04015.c */
  3967.  
  3968. #include "teglsys.h"
  3969.  
  3970. unsigned poof(imagestkptr ifs, msclickptr ms)
  3971.   {
  3972.     hidemouse();
  3973.     dropstackimage(ifs);
  3974.     showmouse();
  3975.     return(0);
  3976.   }
  3977.  
  3978. void main()
  3979.   {
  3980.  
  3981.     easytegl();
  3982.  
  3983.     pushimage(1,1,100,100);
  3984.     shadowbox(1,1,100,100);
  3985.  
  3986.     setmoveframecallproc(stackptr,poof);
  3987.  
  3988.     teglsupervisor();
  3989.  
  3990.   }
  3991.  
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.  
  3998. ___________________________________________________________________________
  3999.  
  4000. movestackimage                                                             
  4001. ___________________________________________________________________________
  4002.  
  4003.  
  4004.  
  4005.  Programmer's Reference Guide       - 68 -         TEGL Windows Toolkit
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.                           Chapter 4 - Frames
  4012.  
  4013. Function
  4014.                    Move a frame to a new screen location.
  4015. Syntax
  4016.                    void movestackimage(imagestkptr frame, unsigned x,
  4017.                      unsigned y);
  4018. Remarks
  4019.                    Used to move a frame under Program control to a new
  4020.                    screen location. x and y are absolute coordinates that
  4021.                    specify the upper left corner of the frame at the new
  4022.                    location.
  4023. Restrictions
  4024.                    The coordinates are not validated, so care must be
  4025.                    taken to ensure that the resulting coordinates of the
  4026.                    lower right corner falls within the screen area.
  4027. See also
  4028.                    frameselectandmove, setmoverestrictions,
  4029.                    setframemobility, setframecallproc
  4030. Example
  4031.                    The following example moves a smaller frame under
  4032.                    another larger frame to demonstrate the integrity of
  4033.                    stacked images.
  4034.  
  4035.  
  4036.  
  4037. /* samc04016.c */
  4038.  
  4039. #include "teglsys.h"
  4040.  
  4041.  
  4042. void main()
  4043.   {
  4044.     imagestkptr fs;
  4045.     unsigned i;
  4046.  
  4047.     easytegl();
  4048.  
  4049.     pushimage(1,1,20,20);
  4050.     shadowbox(1,1,20,20);
  4051.     fs = stackptr;
  4052.  
  4053.     pushimage(50,50,150,150);
  4054.     shadowbox(50,50,150,150);
  4055.  
  4056.     for(i=0;i<=100;i++)
  4057.       movestackimage(fs,fs->x+2,fs->y+2);
  4058.  
  4059.     while(mouse_buttons == 0);
  4060.     abort_msg("");
  4061.   }
  4062.  
  4063.  
  4064.  Programmer's Reference Guide       - 69 -         TEGL Windows Toolkit
  4065.  
  4066.  
  4067.  
  4068.  
  4069.  
  4070.                           Chapter 4 - Frames
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077. ___________________________________________________________________________
  4078.  
  4079. moveframe                                                                  
  4080. ___________________________________________________________________________
  4081.  
  4082.  
  4083.  
  4084. Function
  4085.                    Moves an Xor wire frame from one location to
  4086.                    another.
  4087. Syntax
  4088.                    moveframe(int *fx, int *fy, int *fx1, int* fy1,
  4089.                      int rx, int ry, int rx1,int ry1, int color); 
  4090. Remarks
  4091.                    This only moves a wire frame not the actual frame.
  4092.                    The mouse button must be held down on entry or this
  4093.                    function returns immediately. rx,ry,rx1,ry1 are
  4094.                    the starting coordinates. fx,fy,fx1,fy1 are the
  4095.                    coordinates when the mouse button is released.
  4096.                    color is the wireframe color.
  4097.  
  4098.  
  4099. Low Level Frame Functions
  4100.  
  4101.  
  4102. ___________________________________________________________________________
  4103.  
  4104. unlinkfs                                                                   
  4105. ___________________________________________________________________________
  4106.  
  4107.  
  4108. Function
  4109.                    Disconnects a frame from the stack.
  4110. Syntax
  4111.                    void unlinkfs(imagestkptr frame);
  4112. Remarks
  4113.                    UnLinkFS allows you to disconnect a frame from the
  4114.                    Image stack to stop any further actions by the frame
  4115.                    manager.
  4116.  
  4117.                    This procedure is used throughout the window management
  4118.                    routines. It is provided as an external routine only
  4119.                    for specialized needs.
  4120. Restrictions
  4121.                    This procedure should be used in conjunction with 
  4122.  
  4123.  Programmer's Reference Guide       - 70 -         TEGL Windows Toolkit
  4124.  
  4125.  
  4126.  
  4127.  
  4128.  
  4129.                           Chapter 4 - Frames
  4130.  
  4131.                    hideimage, showimage, createimagebuffer, 
  4132.                    dropimagebuffer, and linkfs.
  4133.  
  4134.                    If you unlink a frame from the stack without first
  4135.                    hiding the frame, the stack manager will not
  4136.                    acknowledge the existence of the frame and will
  4137.                    overwrite the unlinked frame area.
  4138. See also
  4139.                    linkfs, linkunderfs
  4140. Example
  4141.                    The following example hides the frame before unlinking
  4142.                    and dropping the image.
  4143.  
  4144.  
  4145. /* samc04017.c */
  4146.  
  4147. #include "teglsys.h"
  4148.  
  4149.  
  4150. void main()
  4151.   {
  4152.     imagestkptr fs;
  4153.  
  4154.     easytegl();
  4155.  
  4156.     pushimage(1,1,100,100);
  4157.     shadowbox(1,1,100,100);
  4158.     fs = stackptr;
  4159.  
  4160.     pushimage(50,50,150,150);
  4161.     shadowbox(50,50,150,150);
  4162.  
  4163.     showmouse();
  4164.     while(mouse_buttons == 0);
  4165.  
  4166.     hideimage(fs);
  4167.     unlinkfs(fs);
  4168.     dropimagebuffer(fs);
  4169.  
  4170.     while(mouse_buttons == 0);
  4171.     abort_msg("");
  4172.   }
  4173.  
  4174.  
  4175.  
  4176.  
  4177.  
  4178.  
  4179.  
  4180. ___________________________________________________________________________
  4181.  
  4182.  Programmer's Reference Guide       - 71 -         TEGL Windows Toolkit
  4183.  
  4184.  
  4185.  
  4186.  
  4187.  
  4188.                           Chapter 4 - Frames
  4189.  
  4190.  
  4191. linkfs                                                                     
  4192. ___________________________________________________________________________
  4193.  
  4194.  
  4195. Function
  4196.                    Reconnects a frame to the stack.
  4197. Syntax
  4198.                    void linkfs(imagestkptr frame1,imagestkptr frame2)
  4199. Remarks
  4200.                    linkfs reconnects frame1 with the frame stack, above
  4201.                    frame2.
  4202.  
  4203.                    This procedure is used throughout the window management
  4204.                    routines. It is provided as an external routine only
  4205.                    for specialized needs.
  4206. Restrictions
  4207.                    This procedure should be used in conjunction with 
  4208.                    hideimage, showimage, createimagebuffer, 
  4209.                    dropimagebuffer, and unlinkfs.
  4210. See also
  4211.                    unlinkfs, linkunderfs
  4212. Example
  4213.                    The following example performs the same function as 
  4214.                    rotatestackimage.
  4215.  
  4216.  
  4217. /* samc04018.c */
  4218.  
  4219. #include "teglsys.h"
  4220.  
  4221.  
  4222. void main()
  4223.   {
  4224.     imagestkptr fs;
  4225.  
  4226.     easytegl();
  4227.  
  4228.     pushimage(1,1,100,100);
  4229.     shadowbox(1,1,100,100);
  4230.     fs = stackptr;
  4231.  
  4232.     pushimage(50,50,150,150);
  4233.     shadowbox(50,50,150,150);
  4234.  
  4235.     showmouse();
  4236.     while(mouse_buttons == 0);
  4237.  
  4238.     hideimage(fs);
  4239.     unlinkfs(fs);
  4240.  
  4241.  Programmer's Reference Guide       - 72 -         TEGL Windows Toolkit
  4242.  
  4243.  
  4244.  
  4245.  
  4246.  
  4247.                           Chapter 4 - Frames
  4248.  
  4249.     linkfs(fs,stackptr);
  4250.     showimage(fs,fs->x,fs->y);
  4251.  
  4252.     while(mouse_buttons == 0);
  4253.     abort_msg("");
  4254.   }
  4255.  
  4256.  
  4257.  
  4258.  
  4259.  
  4260.  
  4261.  
  4262. ___________________________________________________________________________
  4263.  
  4264. linkunderfs                                                                
  4265. ___________________________________________________________________________
  4266.  
  4267.  
  4268. Function
  4269.                    Reconnects a frame with the frame stack, below the
  4270.                    specified frame.
  4271. Syntax
  4272.                    linkunderfs(imagestkptr frame1,imagestkptr frame2)
  4273. Remarks
  4274.                    linkunderfs reconnects frame1 below frame2.
  4275.  
  4276.                    This procedure is used throughout the window management
  4277.                    routines. It is provided as an external routine only
  4278.                    for specialized needs.
  4279. Restrictions
  4280.                    This procedure should be used in conjunction with 
  4281.                    hideimage, showimage, createimagebuffer, 
  4282.                    dropimagebuffer, and unlinkfs.
  4283. See also
  4284.                    unlinkfs, linkfs
  4285. Example
  4286.                    The following example performs the same function as 
  4287.                    rotateunderstackimage.
  4288.  
  4289.  
  4290. /* samc04019.c */
  4291.  
  4292. #include "teglsys.h"
  4293.  
  4294.  
  4295. void main()
  4296.   {
  4297.     imagestkptr fs1,fs2;
  4298.  
  4299.  
  4300.  Programmer's Reference Guide       - 73 -         TEGL Windows Toolkit
  4301.  
  4302.  
  4303.  
  4304.  
  4305.  
  4306.                           Chapter 4 - Frames
  4307.  
  4308.     easytegl();
  4309.  
  4310.     pushimage(1,1,100,100);
  4311.     shadowbox(1,1,100,100);
  4312.     fs1 = stackptr;
  4313.  
  4314.     pushimage(50,50,150,150);
  4315.     shadowbox(50,50,150,150);
  4316.     fs2 = stackptr;
  4317.  
  4318.     showmouse();
  4319.     while(mouse_buttons == 0);
  4320.  
  4321.     hideimage(fs2);
  4322.     unlinkfs(fs2);
  4323.     linkunderfs(fs2,fs1);
  4324.     showimage(fs2,fs2->x,fs2->y);
  4325.  
  4326.     while(mouse_buttons == 0);
  4327.     abort_msg("");
  4328.   }
  4329.  
  4330.  
  4331.  
  4332.  
  4333.  
  4334.  
  4335.  
  4336. ___________________________________________________________________________
  4337.  
  4338. createimagebuffer                                                          
  4339. ___________________________________________________________________________
  4340.  
  4341.  
  4342. Function
  4343.                    Allocates an Image buffer (frame) on the Heap.
  4344. Syntax
  4345.                    void createimagebuffer(imagestkptr *frame,
  4346.                      unsigned x, unsigned y, unsigned x1, unsigned y1);
  4347. Remarks
  4348.                    This procedure is used throughout the window management
  4349.                    routines. It is provided as an external routine only
  4350.                    for specialized needs.
  4351. Restrictions
  4352.                    This procedure should be used in conjunction with 
  4353.                    hideimage, showimage, createimagebuffer, 
  4354.                    dropimagebuffer, and unlinkfs.
  4355. See also
  4356.                    dropimagebuffer
  4357. Example
  4358.  
  4359.  Programmer's Reference Guide       - 74 -         TEGL Windows Toolkit
  4360.  
  4361.  
  4362.  
  4363.  
  4364.  
  4365.                           Chapter 4 - Frames
  4366.  
  4367.                    The following example performs the same function as 
  4368.                    pushimage.
  4369.  
  4370.  
  4371. /* samc04020.c */
  4372.  
  4373. #include "teglsys.h"
  4374.  
  4375.  
  4376. void main()
  4377.   {
  4378.     imagestkptr fs;
  4379.  
  4380.     easytegl();
  4381.  
  4382.     createimagebuffer(&fs,1,1,100,100);
  4383.     linkfs(fs,stackptr);
  4384.     getbiti(1,1,100,100,fs->imagesave);
  4385.     shadowbox(1,1,100,100);
  4386.  
  4387.     showmouse();
  4388.     teglsupervisor();
  4389.   }
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397. ___________________________________________________________________________
  4398.  
  4399. dropimagebuffer                                                            
  4400. ___________________________________________________________________________
  4401.  
  4402.  
  4403. Function
  4404.                    Frees the memory used by the frame on the heap.
  4405. Syntax
  4406.                    void dropimagebuffer(imagestkptr frame);
  4407. Remarks
  4408.                    This procedure is used throughout the window management
  4409.                    routines. It is provided as an external routine only
  4410.                    for specialized needs.
  4411. Restrictions
  4412.                    This procedure should be used in conjunction with 
  4413.                    hideimage, showimage, createimagebuffer, 
  4414.                    dropimagebuffer, and unlinkfs.
  4415. See also
  4416.                    createimagebuffer
  4417.  
  4418.  Programmer's Reference Guide       - 75 -         TEGL Windows Toolkit
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424.                           Chapter 4 - Frames
  4425.  
  4426. Example
  4427.                    The following example performs the same function as 
  4428.                    popimage.
  4429.  
  4430.  
  4431.  
  4432.  
  4433.  
  4434.  
  4435.  
  4436.  
  4437.  
  4438. ___________________________________________________________________________
  4439.  
  4440. getfsimage                                                                 
  4441. ___________________________________________________________________________
  4442.  
  4443.  
  4444. Function
  4445.                    Retrieves the screen image within a stacked frame.
  4446. Syntax
  4447.                    void getfsimage(unsigned x, unsigned y,
  4448.                      imagestkptr frame);
  4449. Result type
  4450.                    Returns a (non-stacked) frame containing the screen
  4451.                    image and other related frame information.
  4452. Remarks
  4453.                    The (non-stacked) frame may be used for replication or
  4454.                    it can be merged with other frames.
  4455. See also
  4456.                    putfsimage
  4457. Example
  4458.                    The following example creates a single frame and
  4459.                    replicates the frame.
  4460.  
  4461.  
  4462.  
  4463.  
  4464.  
  4465.  
  4466.  
  4467.  
  4468.  
  4469.  
  4470. ___________________________________________________________________________
  4471.  
  4472. putfsimage                                                                 
  4473. ___________________________________________________________________________
  4474.  
  4475.  
  4476.  
  4477.  Programmer's Reference Guide       - 76 -         TEGL Windows Toolkit
  4478.  
  4479.  
  4480.  
  4481.  
  4482.  
  4483.                           Chapter 4 - Frames
  4484.  
  4485. Function
  4486.                    Places the frame saved image anywhere on the screen.
  4487. Syntax
  4488.                    void putfsimage(unsigned x, unsigned y,
  4489.                      imagestkptr frame, unsigned rwbits);
  4490. Remarks
  4491.                    rwbits are constants defined in "teglsys.h" which
  4492.                    define how the images are placed on the screen.
  4493.  
  4494. FGNORN
  4495.                    replaces screen area with frame image
  4496. FGAND
  4497.                    AND's screen area with frame image. Toggles off screen
  4498.                    areas that do no have a frame image. Creates an outline
  4499.                    of the frame image.
  4500. FGOR
  4501.                    OR's screen area with frame image. Toggles on empty
  4502.                    screen areas that have a frame image. Creates a solid
  4503.                    frame image.
  4504. FGXOR
  4505.                    XOR's screen area with frame image.
  4506. FGNOT
  4507.                    Inverts frame image and replaces screen area with
  4508.                    image.
  4509.  
  4510. See also
  4511.                    getfsimage
  4512. Example
  4513.                    The following example creates a single frame and
  4514.                    replicates the frame.
  4515.  
  4516.  
  4517.  
  4518.  
  4519.  
  4520.  
  4521.  
  4522.  
  4523. ___________________________________________________________________________
  4524.  
  4525. freeimagebuffer                                                            
  4526. ___________________________________________________________________________
  4527.  
  4528.  
  4529.  
  4530. Function
  4531.                    Frees up the memory allocated for a frame buffer.
  4532. Syntax
  4533.                    void freeimagebuffer(imagestkptr ifs); 
  4534. Remarks
  4535.  
  4536.  Programmer's Reference Guide       - 77 -         TEGL Windows Toolkit
  4537.  
  4538.  
  4539.  
  4540.  
  4541.  
  4542.                           Chapter 4 - Frames
  4543.  
  4544.                    This is generally an internal function. Do not use it
  4545.                    unless you have a clear understanding of inner workings
  4546.                    of the frame stack.
  4547.  
  4548.  
  4549.  
  4550. ___________________________________________________________________________
  4551.  
  4552. getpartialfrontimage                                                       
  4553. ___________________________________________________________________________
  4554.  
  4555.  
  4556.  
  4557. Function
  4558.                    Gets the partial image of a frame and returns a pointer
  4559.                    to a temporary buffer.
  4560. Syntax
  4561.                    imagestkptr getpartialfrontimage(imagestkptr frame,
  4562.                      unsigned x, unsigned y, unsigned x1, unsigned y1);
  4563. Remarks
  4564.                    This is a safer way to get the partial image of a
  4565.                    frame than using GetBiti. Overlapping frames are
  4566.                    partially removed and then restored before returning.
  4567.  
  4568.  
  4569.  
  4570.  
  4571. ___________________________________________________________________________
  4572.  
  4573. getfrontimage                                                              
  4574. ___________________________________________________________________________
  4575.  
  4576.  
  4577.  
  4578. Function
  4579.                    Get the image of a frame and returns a pointer to
  4580.                    a temporary buffer.
  4581. Syntax
  4582.                    Macro
  4583.                    imagestkptr getfrontimage(imagestkptr ifs);
  4584. Remarks
  4585.                    This is a safer way to get the image of a frame
  4586.                    than using GetBiti. Overlapping frames are
  4587.                    partially removed and then restored before returning.
  4588.  
  4589.  
  4590.  
  4591. ___________________________________________________________________________
  4592.  
  4593. pageinfs                                                                   
  4594.  
  4595.  Programmer's Reference Guide       - 78 -         TEGL Windows Toolkit
  4596.  
  4597.  
  4598.  
  4599.  
  4600.  
  4601.                           Chapter 4 - Frames
  4602.  
  4603. ___________________________________________________________________________
  4604.  
  4605.  
  4606.  
  4607. Function
  4608.                    Read an image into memory.
  4609. Syntax
  4610.                    void pageinfs(imagestkptr ifs); 
  4611. Remarks
  4612.                    If the image is already in memory then no action
  4613.                    is taken.
  4614. See also
  4615.                    pageoutfs.
  4616. Example
  4617.                    This example checks to see if the image is in memory
  4618.                    first before attempting to read it in. note that 
  4619.                    pageinfs check this automatically before reading in an
  4620.                    image.
  4621.  
  4622.  
  4623.   if ifs->imagepageout then    /* the image is not in memory */
  4624.     pageinfs(ifs);
  4625.  
  4626.  
  4627.  
  4628.  
  4629.  
  4630. ___________________________________________________________________________
  4631.  
  4632. lockimage                                                                  
  4633. ___________________________________________________________________________
  4634.  
  4635.  
  4636.  
  4637. Function
  4638.                    Locks an frame image into memory.
  4639. Syntax
  4640.                    Macro
  4641.                    void lockimage(imagestkptr ifs); 
  4642. Remarks
  4643.                    The image is read into memory if required. The lock is
  4644.                    maintained until a specific call is made to
  4645.                    unlockimage.
  4646.  
  4647.                    Lock image can be used where it is desirable to
  4648.                    replicate an image on the screen repeatedly. After it
  4649.                    is locked then it can be placed on the screen with a
  4650.                    call to putbiti.
  4651. Restrictions
  4652.                    This should be used with caution especially if you are
  4653.  
  4654.  Programmer's Reference Guide       - 79 -         TEGL Windows Toolkit
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.                           Chapter 4 - Frames
  4661.  
  4662.                    locking in a large image. You can fragment the heap and
  4663.                    the Virtual Memory Manager may not be able to allocate
  4664.                    a large enough memory block for subsequent image swaps.
  4665. See also
  4666.                    unlockimage, useimage, unuseimage
  4667. Example
  4668.                    If the image is less than 64k then it can be copied
  4669.                    to Turbo's heap and then the image can be unlocked
  4670.                    reducing the chance of a heap error.
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679. ___________________________________________________________________________
  4680.  
  4681. pageoutfs                                                                  
  4682. ___________________________________________________________________________
  4683.  
  4684.  
  4685.  
  4686. Function
  4687.                    Page out a frame image.
  4688. Syntax
  4689.                    pageoutfs(imagestkptr ifs); 
  4690. Remarks
  4691.                    If the image is successfully paged out to ems or disk
  4692.                    then teglfreemem is called to free up the memory
  4693.                    used.
  4694. Restrictions
  4695.                    If ifs is in use, or locked or already paged out
  4696.                    then no action is taken.
  4697. See also
  4698.                    pageinfs.
  4699. Example
  4700.  
  4701.  
  4702.  
  4703.   pageoutfs(ifs);
  4704.   if (ifs->imagepageout)   /* success */
  4705.     
  4706.     else ;  /* failure */
  4707.  
  4708.  
  4709.  
  4710.  
  4711.  
  4712.  
  4713.  Programmer's Reference Guide       - 80 -         TEGL Windows Toolkit
  4714.  
  4715.  
  4716.  
  4717.  
  4718.  
  4719.                           Chapter 4 - Frames
  4720.  
  4721. ___________________________________________________________________________
  4722.  
  4723. setimagecoordinates                                                        
  4724. ___________________________________________________________________________
  4725.  
  4726.  
  4727.  
  4728. Function
  4729.                    Sets the frame pointer to a new set of coordinates.
  4730. Syntax
  4731.                    Macro
  4732.                    void setimagecoordinates(imagestkptr ifs,
  4733.                      unsigned x, unsigned y,unsigned x1,unsigned y1); 
  4734. Remarks
  4735.                    A frame's coordinates should not be changed if it is
  4736.                    visible.
  4737.  
  4738.  
  4739.  
  4740. ___________________________________________________________________________
  4741.  
  4742. pageoutimagestack                                                          
  4743. ___________________________________________________________________________
  4744.  
  4745.  
  4746.  
  4747. Function
  4748.                    Requests the virtual memory manager to page out
  4749.                    images to make a chunk of memory available.
  4750. Syntax
  4751.                    char pageoutimagestack(unsigned long mem);
  4752. Remarks
  4753.                    mem is the amount of memory required. A large
  4754.                    value for mem will result in all image buffers
  4755.                    being paged out. This function returns true if the
  4756.                    amount of memory requested has been freed.
  4757. Restrictions
  4758.                    Large amounts of memory are required to process image
  4759.                    swapping. If you allocate too much and don't free it up
  4760.                    as quickly as possible you may get a heap error.
  4761.  
  4762. Example
  4763.  
  4764.  
  4765.   /* -- force all imagebuffers to disk */
  4766.   if (pageoutimagestack(512000)) ;   /* -- ignore result */
  4767.   /* -- do whatever needs that much memory */
  4768.   supersortmemuse(256000);
  4769.   supersort();
  4770.   /* -- release it before working with windows again */
  4771.  
  4772.  Programmer's Reference Guide       - 81 -         TEGL Windows Toolkit
  4773.  
  4774.  
  4775.  
  4776.  
  4777.  
  4778.                           Chapter 4 - Frames
  4779.  
  4780.   supersortfreemem();
  4781.  
  4782.  
  4783.  
  4784.  
  4785.  
  4786.  
  4787. ___________________________________________________________________________
  4788.  
  4789. unlockimage                                                                
  4790. ___________________________________________________________________________
  4791.  
  4792.  
  4793.  
  4794. Function
  4795.                    Unlocks a frame image.
  4796. Syntax
  4797.                    Macro
  4798.                    unlockimage(imagestkptr ifs); 
  4799. Remarks
  4800.                    unlock simply sets a flag in the imagestkptr.
  4801.                    After unlocking, the Virtual Memory Manager can swap
  4802.                    the image to EMS or Disk as required. If the image
  4803.                    wasn't locked then no action is taken.
  4804. Restrictions
  4805.                    see restrictions for lockimage.
  4806. See also
  4807.                    lockimage, useimage, unuseimage.
  4808. Example
  4809.                    see example for lockimage.
  4810.  
  4811.  
  4812.  
  4813.  
  4814. ___________________________________________________________________________
  4815.  
  4816. unuseimage                                                                 
  4817. ___________________________________________________________________________
  4818.  
  4819.  
  4820.  
  4821. Function
  4822.                    Flags a frame image as no longer in use.
  4823. Syntax
  4824.                    Macro
  4825.                    unuseimage(var ifs : imagestkptr); 
  4826. Remarks
  4827.                    This should be called as soon as possible after a 
  4828.                    useimage to keep as much memory free for the virtual
  4829.                    memory manager.
  4830.  
  4831.  Programmer's Reference Guide       - 82 -         TEGL Windows Toolkit
  4832.  
  4833.  
  4834.  
  4835.  
  4836.  
  4837.                           Chapter 4 - Frames
  4838.  
  4839. See also
  4840.                    useimage, lockimage, unlockimage.
  4841. Example
  4842.  
  4843.  
  4844.   useimage(ifs);
  4845.   /* -- do something with it */
  4846.  
  4847.   /* -- then let the memory manager swap it out if required */
  4848.   unuseimage(ifs);
  4849.  
  4850.  
  4851.  
  4852.  
  4853.  
  4854.  
  4855. ___________________________________________________________________________
  4856.  
  4857. useimage                                                                   
  4858. ___________________________________________________________________________
  4859.  
  4860.  
  4861.  
  4862. Function
  4863.                    Makes an image available for use.
  4864. Syntax
  4865.                    Macro
  4866.                    useimage(var ifs : imagestkptr); 
  4867. Remarks
  4868.                    The frame image is read into memory if not already
  4869.                    there and then flagged as being in use.
  4870. Restrictions
  4871.                    if you do prepareforupdate then the in use flag is
  4872.                    set to false.
  4873. See also
  4874.                    unuseimage, lockimage, unlockimage.
  4875. Example
  4876.  
  4877.  
  4878.   useimage(ifs);
  4879.   /* -- do something with it */
  4880.  
  4881.   /* -- then let the memory manager swap it out if required */
  4882.   unuseimage(ifs);
  4883.  
  4884.  
  4885.  
  4886.  
  4887.  
  4888.  
  4889.  
  4890.  Programmer's Reference Guide       - 83 -         TEGL Windows Toolkit
  4891.  
  4892.  
  4893.  
  4894.  
  4895.  
  4896.                           Chapter 4 - Frames
  4897.  
  4898. Mouse Click Areas
  4899.  
  4900. Mouse click areas are those places on the screen where we sense if the
  4901. mouse pointer has passed over or has been clicked on. Frames can have
  4902. mouse click areas on them that are, of course, only available if the frame
  4903. is visible and the mouse click area is uncovered.
  4904.  
  4905. The sensitivity of the mouse click area has two levels. The most sensitive
  4906. is MSSENSE where just having the mouse pointer pass over the area
  4907. causes an action. The other level is MSCLICK where the mouse pointer
  4908. must be over the mouse click area and the left mouse button has been
  4909. pressed.
  4910.  
  4911.  
  4912.  
  4913. ___________________________________________________________________________
  4914.  
  4915. definemouseclickarea                                                       
  4916. ___________________________________________________________________________
  4917.  
  4918.  
  4919.  
  4920. Function
  4921.                    Attaches an sensitive area of a frame to an event
  4922.                    function.
  4923. Syntax
  4924.                    void definemouseclickarea(imagestkptr ifs, unsigned x,
  4925.                      unsigned y, unsigned x1, unsigned y1,char active,
  4926.                        callproc p, char sense);
  4927. Remarks
  4928.                    ifs is any imagestkptr. the x, y, x1, y1 are
  4929.                    coordinates relative to a frame. This means that the
  4930.                    upper left corner of a frame is considered 0,0.
  4931.  
  4932.                    active is a boolean flag to indicate whether the
  4933.                    Mouse Click Area is an active entry TRUE or a
  4934.                    place holder FALSE in a list of mouse clicks. A
  4935.                    place holder is simply a defined entry with no action
  4936.                    recognized.
  4937.  
  4938.                    p is the event to call when the Mouse Click Area
  4939.                    is activated, either by the mouse pointer passing by
  4940.                    the click areas or a mouse click occurring on an click
  4941.                    area.
  4942.  
  4943.                    nilunitproc may be used to define a no-event
  4944.                    handler. This may be used in conjunction with the
  4945.                    functions findframe and checkmouseclickpos to
  4946.                    check for the respective mouse click activation.
  4947.  
  4948.  
  4949.  Programmer's Reference Guide       - 84 -         TEGL Windows Toolkit
  4950.  
  4951.  
  4952.  
  4953.  
  4954.  
  4955.                           Chapter 4 - Frames
  4956.  
  4957.                    nilunitproc may also be used as a temporary
  4958.                    parameter. use resetmsclickcallproc to add the proper
  4959.                    event handler later.
  4960.  
  4961.                    sense is either MSSENSE or MSCLICK. MSSense
  4962.                    activates the event handler whenever the mouse cursor
  4963.                    passes over the defined mouse click areas. MSCLICK
  4964.                    requires the right mouse button to be pressed while the
  4965.                    mouse cursor is on the mouse click area.
  4966. Restrictions
  4967.                    The number of mouse click areas is limited only by
  4968.                    memory. Overlapping click area take priority over
  4969.                    underlying click areas.
  4970.  
  4971.                    The coordinates of a Mouse click area must reside
  4972.                    within the Frame, otherwise the click areas are not
  4973.                    recognized.
  4974. See also
  4975.                    findmouseclickptr, resetmouseclicks,
  4976.                    resetmsclicksense, resetmsclickcallproc,
  4977.                    resetmsclickactive, checkmouseclickpos
  4978. Example
  4979.                    The following example creates a frame that attaches an
  4980.                    'OK' icon with an Event Handler called DropBoxOption
  4981.                    which simply closes the frame and exits.
  4982.  
  4983.                    The function CheckforMouseSelect is used to create
  4984.                    the illusion of a button being pressed when clicked on.
  4985.  
  4986.  
  4987.  
  4988.  
  4989.  
  4990.  
  4991.  
  4992.  
  4993.  
  4994. ___________________________________________________________________________
  4995.  
  4996. findmouseclickptr                                                          
  4997. ___________________________________________________________________________
  4998.  
  4999.  
  5000. Function
  5001.                    Searches for a Mouse Click Pointer associated with a
  5002.                    Mouse Click Number.
  5003. Syntax
  5004.                    msclickptr findmouseclickptr(imagestkptr ifs,
  5005.                      unsigned clicknumber);
  5006. Result type
  5007.  
  5008.  Programmer's Reference Guide       - 85 -         TEGL Windows Toolkit
  5009.  
  5010.  
  5011.  
  5012.  
  5013.  
  5014.                           Chapter 4 - Frames
  5015.  
  5016.                    Returns a mouse click pointer (msclickptr), pointing to
  5017.                    a Mouse Click Structure.
  5018. Remarks
  5019.                    Click Numbers are in the order that you define the
  5020.                    Mouse Click areas. The first definemouseclickarea is
  5021.                    known as Click Number 1, the second is Click Number 2,
  5022.                    etc..
  5023.  
  5024.                    In certain instances it is easier to advance through
  5025.                    the mouse click areas by Click Numbers. However, most
  5026.                    functions, including the calling of Events, pass the
  5027.                    Mouse Click Pointer.
  5028.  
  5029.                    To translate a Mouse Click Pointer back to a Click
  5030.                    Number, use the Mouse Click Pointer fields ie.
  5031.                    clicknumber := mouseclickpos->clicknumber where
  5032.                    mouseclickpos is of type msclickptr.
  5033. Restrictions
  5034.                    findmouseclickptr returns a NULL if the clicknumber is
  5035.                    not found. Compare the resulting msclickptr with NULL
  5036.                    before referencing the structure.
  5037. See also
  5038.                    definemouseclickptr, resetmouseclicks,
  5039.                    resetmsclicksense, resetmsclickcallproc,
  5040.                    resetmsclickactive, checkmouseclickpos
  5041. Example
  5042.                    The following example defines an array of 100 Mouse
  5043.                    Click Areas. You may click with the left mouse button
  5044.                    on the individual tiles to produce a sound, or on the
  5045.                    'OK' to produce a series of sounds.
  5046.  
  5047.                    The function findmouseclickptr is used within the
  5048.                    event handler playallnotes to translate a random
  5049.                    click number into a note.
  5050.  
  5051.                    The function checkformouseselect is used to create
  5052.                    the illusion of a button being pressed when clicked on.
  5053.  
  5054.  
  5055.  
  5056.  
  5057.  
  5058.  
  5059.  
  5060.  
  5061.  
  5062. ___________________________________________________________________________
  5063.  
  5064. resetmsclickactive                                                         
  5065. ___________________________________________________________________________
  5066.  
  5067.  Programmer's Reference Guide       - 86 -         TEGL Windows Toolkit
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.                           Chapter 4 - Frames
  5074.  
  5075.  
  5076.  
  5077. Function
  5078.                    Resets the active flag to indicate whether a Mouse
  5079.                    Click Area Entry is active or inactive.
  5080. Syntax
  5081.                    void resetmsclickactive(imagestkptr ifs,
  5082.                      unsigned mouseclicknumber, char active); 
  5083. Remarks
  5084.                    The mouseclicknumber is in the order that you defined
  5085.                    the mouse click areas. the first definemouseclickarea
  5086.                    is known as mouseclicknumber 1, the second is
  5087.                    mouseclicknumber 2, etc..
  5088.  
  5089.                    active is a boolean flag to indicate whether the mouse
  5090.                    Click Area is an active entry (TRUE) or a place holder
  5091.                    (FALSE) in a list of mouse clicks. A place holder is
  5092.                    simple a defined entry with no action recognized.
  5093. Restrictions
  5094.                    if the mouseclicknumber is invalid, the flag is not
  5095.                    updated.
  5096. See also
  5097.                    definemouseclickptr, resetmouseclicks,
  5098.                    findmouseclickptr, resetmsclicksense,
  5099.                    resetmsclickcallproc, checkmouseclickpos
  5100. Example
  5101.                    This example creates an array of 10 buttons which all
  5102.                    point to the same event handler switchon. the
  5103.                    active flag for a pressed button is turned off to
  5104.                    prevent multiple calls to switchon, until another
  5105.                    button is pressed. resetmsclickactive is used
  5106.                    within switchon to toggle the button active state.
  5107.  
  5108.  
  5109.  
  5110.  
  5111.  
  5112.  
  5113.  
  5114.  
  5115.  
  5116. ___________________________________________________________________________
  5117.  
  5118. resetmsclickcallproc                                                       
  5119. ___________________________________________________________________________
  5120.  
  5121.  
  5122. Function
  5123.                    Changes the Event Handler for a Mouse click to another
  5124.                    Event Handler.
  5125.  
  5126.  Programmer's Reference Guide       - 87 -         TEGL Windows Toolkit
  5127.  
  5128.  
  5129.  
  5130.  
  5131.  
  5132.                           Chapter 4 - Frames
  5133.  
  5134. Syntax
  5135.                    void resetmsclickcallproc(imagestkptr ifs,
  5136.                      unsigned mouseclicknumber, callproc p);
  5137. Remarks
  5138.                    mouseclicknumbers are in the order that you define the
  5139.                    mouse click areas. the first definemouseclickarea is
  5140.                    known as mouseclicknumber 1, the second is
  5141.                    mouseclicknumber 2, etc..
  5142.  
  5143.                    p is the event to pass control to when the mouse
  5144.                    click area is actived.
  5145.  
  5146.                    nilunitproc may be used to define a no-event
  5147.                    handler. This may be used in conjunction with the
  5148.                    functions findframe and checkmouseclickpos to
  5149.                    check for the respective mouse click activation.
  5150.  
  5151.                    nilunitproc may also be used to deactivate an
  5152.                    event handler.
  5153. See also
  5154.                    definemouseclickptr, resetmouseclicks,
  5155.                    findmouseclickptr, resetmsclicksense,
  5156.                    resetmsclickactive, checkmouseclickpos
  5157. Example
  5158.                    This example switches between two events that play a
  5159.                    different series of sounds. The function 
  5160.                    checkformouseselect is used to create the illusion of
  5161.                    a button being pressed when clicked on.
  5162.  
  5163.  
  5164.  
  5165.  
  5166.  
  5167.  
  5168.  
  5169.  
  5170.  
  5171. ___________________________________________________________________________
  5172.  
  5173. resetmouseclicks                                                           
  5174. ___________________________________________________________________________
  5175.  
  5176.  
  5177. Function
  5178.                    Removes a chain of mouse click areas from a frame.
  5179. Syntax
  5180.                    void resetmouseclicks(imagestkptr frame,
  5181.                      msclickptr clickptr)
  5182. Remarks
  5183.                    the clickptr parameter is the last click pointer from
  5184.  
  5185.  Programmer's Reference Guide       - 88 -         TEGL Windows Toolkit
  5186.  
  5187.  
  5188.  
  5189.  
  5190.  
  5191.                           Chapter 4 - Frames
  5192.  
  5193.                    where the remainder of the chain of click areas will be
  5194.                    removed.
  5195.  
  5196.                    A parameter of NULL removes the Mouse Click Area
  5197.                    chain completely.
  5198. Restrictions
  5199.                    the clickptr should be a valid mouseclickptr. Use 
  5200.                    findmouseclickptr to locate a valid pointer.
  5201.  
  5202.                    if clickptr is invalid, the parameter will be treated
  5203.                    as NULL.
  5204. See also
  5205.                    definemouseclickptr, findmouseclickptr,
  5206.                    resetmsclicksense, resetmsclickcallproc,
  5207.                    resetmsclickactive, checkmouseclickpos
  5208. Example
  5209.                    The following example displays a varying number of bars
  5210.                    that can be selected. The Event Handler 
  5211.                    showbarlist plays a sound corresponding to the bar
  5212.                    selected and clears the frame and re-displays a new
  5213.                    series of bars.
  5214.  
  5215.  
  5216.  
  5217.  
  5218.  
  5219.  
  5220.  
  5221.  
  5222.  
  5223. ___________________________________________________________________________
  5224.  
  5225. resetmsclicksense                                                          
  5226. ___________________________________________________________________________
  5227.  
  5228.  
  5229. Function
  5230.                    resets the sense parameter associated with a mouse
  5231.                    Click Area.
  5232. Syntax
  5233.                    void resetmsclicksense(imagestkptr ifs, char newsense;)
  5234. Remarks
  5235.                    newsense is either MSSENSE or MSCLICK. MSSENSE
  5236.                    activates the event handler whenever the mouse cursor
  5237.                    passes over the defined mouse click areas. MSCLICK
  5238.                    requires the right mouse button to be pressed while the
  5239.                    mouse cursor is on the mouse click area.
  5240. Restrictions
  5241.                    resetmsclicksense resets the sense type for the chain
  5242.                    of all Mouse Clicks. If you have a mixture of different
  5243.  
  5244.  Programmer's Reference Guide       - 89 -         TEGL Windows Toolkit
  5245.  
  5246.  
  5247.  
  5248.  
  5249.  
  5250.                           Chapter 4 - Frames
  5251.  
  5252.                    senses, use a combination of findmouseclickptr and
  5253.                    field settings to reset the sense.
  5254. See also
  5255.                    definemouseclickptr, resetmouseclicks,
  5256.                    findmouseclickptr, resetmsclickcallproc,
  5257.                    resetmsclickactive, checkmouseclickpos
  5258. Example
  5259.                    The following example requires a menu selection to
  5260.                    toggle between the menu dropping down automatically or
  5261.                   requiring a mouse clickon the menu bar.
  5262.  
  5263.  
  5264.  
  5265.  
  5266.  
  5267.  
  5268.  
  5269.  
  5270.  
  5271.  
  5272. Keyboard
  5273.  
  5274.  
  5275. ___________________________________________________________________________
  5276.  
  5277. clearkeyboardbuf                                                           
  5278. ___________________________________________________________________________
  5279.  
  5280.  
  5281.  
  5282. Function
  5283.                    Clears the hardware keyboard buffer.
  5284. Syntax
  5285.                    Macro
  5286.                    void clearkeyboardbuf(void); 
  5287. See also
  5288.                    clearteglkeyboardbuf.
  5289.  
  5290.  
  5291.  
  5292.  
  5293. ___________________________________________________________________________
  5294.  
  5295. clearteglkeyboardbuf                                                       
  5296. ___________________________________________________________________________
  5297.  
  5298.  
  5299.  
  5300. Function
  5301.                    Clears the software buffer maintained by the
  5302.  
  5303.  Programmer's Reference Guide       - 90 -         TEGL Windows Toolkit
  5304.  
  5305.  
  5306.  
  5307.  
  5308.  
  5309.                           Chapter 4 - Frames
  5310.  
  5311.                    Toolkit.
  5312. Syntax
  5313.                    Macro
  5314.                    void clearteglkeyboardbuf(void); 
  5315. Remarks
  5316.                    This will discard all pending keystrokes.
  5317.  
  5318.  
  5319.  
  5320. ___________________________________________________________________________
  5321.  
  5322. defineglobalkeyclickarea                                                   
  5323. ___________________________________________________________________________
  5324.  
  5325.  
  5326.  
  5327. Function
  5328.                    Flexible keycode assignment.
  5329. Syntax
  5330.                    void defineglobalkeyclickarea(imagestkptr ifs,
  5331.                      msclickptr ms, unsigned keycode, char repeatkey,
  5332.                        callproc,p 
  5333. Remarks
  5334.                    ifs is the frame and ms is the mouse click
  5335.                    area the key is assigned to, these are passed to 
  5336.                    p.
  5337.  
  5338.                    If ifs and ms are set to nil then the frame
  5339.                    and mouse click area that the mouse pointer is over are
  5340.                    passed to p. If the mouse pointer is not over a
  5341.                    frame then Nil is passed to p.
  5342.  
  5343.                    If repeatkey is set TRUE then addition key presses
  5344.                    are buffered, otherwise, they are discarded.
  5345.  
  5346.                    A special case for this routine is passing 0 as the
  5347.                    keycode parameter. In this case any key that is not
  5348.                    being trapped for will activate p. The key pressed
  5349.                    can be determined by using getch.
  5350. Restrictions
  5351.                    Only the most recently declared key is trapped if a key
  5352.                    is trapped more than once.
  5353. See also
  5354.                    definelocalkeyclickarea.
  5355.  
  5356.  
  5357.  
  5358. ___________________________________________________________________________
  5359.  
  5360. definelocalkeyclickarea                                                    
  5361.  
  5362.  Programmer's Reference Guide       - 91 -         TEGL Windows Toolkit
  5363.  
  5364.  
  5365.  
  5366.  
  5367.  
  5368.                           Chapter 4 - Frames
  5369.  
  5370. ___________________________________________________________________________
  5371.  
  5372.  
  5373.  
  5374. Function
  5375.                    Assign a keycode to a frame and mouse click area.
  5376. Syntax
  5377.                    void definelocalkeyclickarea(imagestkptr ifs,
  5378.                      msclickptr ms, unsigned keycode, char repeatkey,
  5379.                        callproc p);  
  5380. Remarks
  5381.                    ifs is the frame and ms is the mouse click
  5382.                    area the key is assigned to, these are passed to p.
  5383.  
  5384.                    If repeatkey is set TRUE then additional key presses
  5385.                    are buffered otherwise they are discarded.
  5386.  
  5387.                    Within a frame definelocalkeyclickarea has
  5388.                    prioritry over defineglobalkeyclickarea.
  5389. See also
  5390.                    defineglobalkeyclickarea.
  5391.  
  5392.  
  5393.  
  5394. ___________________________________________________________________________
  5395.  
  5396. dropkeyclick                                                               
  5397. ___________________________________________________________________________
  5398.  
  5399.  
  5400.  
  5401. Function
  5402.                    Removes a key trap.
  5403. Syntax
  5404.                    void dropkeyclick(imagestkptr ifs, unsigned keycode,
  5405.                      callproc p): 
  5406. Remarks
  5407.                    If ifs is not NULL then the frame's local key
  5408.                    stack is searched first. If the key is not found then
  5409.                    the search proceeds to the global key stack.
  5410.  
  5411.                    p must match the callproc that the key was
  5412.                    originally assigned to.
  5413.  
  5414.  
  5415.  
  5416. ___________________________________________________________________________
  5417.  
  5418. findkeyclickptr                                                            
  5419. ___________________________________________________________________________
  5420.  
  5421.  Programmer's Reference Guide       - 92 -         TEGL Windows Toolkit
  5422.  
  5423.  
  5424.  
  5425.  
  5426.  
  5427.                           Chapter 4 - Frames
  5428.  
  5429.  
  5430.  
  5431.  
  5432. Function
  5433.                    Locates a key assignment.
  5434. Syntax
  5435.                    keyclickptr findkeyclickptr(imagestkptr ifs,
  5436.                      unsigned keycode);
  5437. Remarks
  5438.                    If ifs is not NULL then the frame's local key stack
  5439.                    is searched first. If the key is not found then the
  5440.                    search proceeds to the global key stack keystackptr.
  5441.  
  5442.                    if the keycode is not found then NULL is returned.
  5443.  
  5444.  
  5445.  
  5446. ___________________________________________________________________________
  5447.  
  5448. resetkeyclickcallproc                                                      
  5449. ___________________________________________________________________________
  5450.  
  5451.  
  5452.  
  5453. Function
  5454.                    Changes the callproc a key is assigned to.
  5455. Syntax
  5456.                    void resetkeyclickcallproc(imagestkptr ifs,
  5457.                      unsigned keycode, callproc p); 
  5458. Remarks
  5459.                    If ifs is not NULL then the frame's local key stack
  5460.                    is searched first. If the key is not found then the
  5461.                    search proceeds to the global key stack keystackptr.
  5462.  
  5463.                    If keycode is not found then no action is taken.
  5464.  
  5465.  
  5466.  
  5467.  
  5468.  
  5469.  
  5470.  
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  Programmer's Reference Guide       - 93 -         TEGL Windows Toolkit
  5481.  
  5482.  
  5483.  
  5484.  
  5485.  
  5486.                           Chapter 5 - Menus
  5487.  
  5488.  
  5489. Drop Down, Pop Up Menus
  5490. ___________________________________________________________________________
  5491.  
  5492. The Menu unit is good example of an event library that you can add to the
  5493. power of TEGL Windows. The generic pull-down or drop-down menus provides a
  5494. wide range of menu architecture that will meet most application needs.
  5495.  
  5496. A Menu event uses the standard outtegltextxy and definemouseclickarea
  5497. functions to list and to create additional mouse click areas on the
  5498. screen.
  5499.  
  5500. Even though the menu unit is comprehensive, TEGL Windows Toolkit II is not
  5501. limited to a standard architecture of menus. The menu unit may be used as
  5502. an example in creating other types of menu events; such as hanging menus
  5503. which are not dependent on a bar type selection; or an icon menu, that
  5504. when clicked on explodes to display a box full of icons that can be
  5505. selected from.
  5506.  
  5507. The entries for the menu unit are created and linked at run-time. The
  5508. entries may be manipulated, copied, or deleted as required within the
  5509. program. In comparison, some systems offer a external menu compiler which
  5510. links the menu with the program at compile time. The advantages to an
  5511. external menu compiler are minimal, and it adds another step in creating a
  5512. menu system.
  5513.  
  5514. The advantages to creating dynamic menus at run-time, is the ability to
  5515. create a menu system that is based on an external text file (ie.  the menu
  5516. text selections may be stored in a text file and read in at run-time to
  5517. create a menu).
  5518.  
  5519. Creating a Menu
  5520.  
  5521. Creating a bar menu is a two step process. The first is to create the
  5522. entry text list that is associated with a option menu. The second is the
  5523. creation of the menu bar from which option menus may be selected. You may
  5524. use the first step by itself to attach an Option Entry list to icon,
  5525. instead of a bar.
  5526.  
  5527.  
  5528. Creating a entry text list
  5529.  
  5530. An entry text list is simply an linked chain of text entries, with a root
  5531. entry for each text list.
  5532.  
  5533.  
  5534. +-----------+      +-----------+--+       +-----------+--+
  5535. |AnchorOMPtr|----->|OptionMenu |01|------>|OptionMenu |02|----->nil
  5536. +-----------+      +-----+-----+--+       +-----+-----+--+
  5537.                          *                      *
  5538.  
  5539.  Programmer's Reference Guide       - 94 -         TEGL Windows Toolkit
  5540.  
  5541.  
  5542.  
  5543.  
  5544.  
  5545.                           Chapter 5 - Menus
  5546.  
  5547.                    +-----------+--+       +-----------+--+
  5548.                    |OptionEntry|01|       |OptionEntry|01|
  5549.                    +-----+-----+--+       +-----+-----+--+
  5550.                          *                      *
  5551.                    +-----------+--+       +-----------+--+
  5552.                    |OptionEntry|02|       |OptionEntry|02|
  5553.                    +-----+-----+--+       +-----+-----+--+
  5554.                          *                      *
  5555.                    +-----------+--+            nil
  5556.                    |OptionEntry|03|
  5557.                    +-----+-----+--+
  5558.                          *
  5559.                         nil
  5560.  
  5561.         +--------------------------------------------------+
  5562.         |  typedef struct optionmenu {                     |
  5563.         |                   optionmptr     nextom;------+  |
  5564.         |                   unsigned       numofentries;|  |
  5565. ------->|                   unsigned       maxwidth;    +--|----------->
  5566.         |                   unsigned       padding;        |
  5567.         |                   fontptr        fonttype;       |
  5568.         |            +----- optioneptr     firstentry;     |
  5569.         |            |      optioneptr     currententry;   |
  5570.         |            |    } optionmenu;                    |
  5571.         |            +------------+                        |
  5572.         +-------------------------|------------------------+
  5573.                                   *
  5574.         +-----------------------------------------------+--+
  5575.         |  typedef struct optionentry {                 |01|
  5576.         |            +----- optioneptr     nextoe;      +--|
  5577.         |            |      char           entryline[41];  |
  5578.         |            |      char           entryactive;    |
  5579.         |            |      int            entrycolor;     |
  5580.         |            |      callproc       entrycallproc;  |
  5581.         |            |    } optionentry;                   |
  5582.         |            +------------+                        |
  5583.         +-------------------------|------------------------+
  5584.                                   *
  5585.  
  5586. OM is a short form for an optionmenu structure. This is the
  5587. header or the root entry for an entry list. The header contains
  5588. information regarding the number of entries, the maximum width of the
  5589. entries, the amount of padding on left and right when displayed and the
  5590. font type that is used. By duplicating the header with a different set of
  5591. parameters, an Option Entry list may be chained to two or more
  5592. headers to allow for different fonts.
  5593.  
  5594.                    +-----------+      +-----------+
  5595.               ---->|OptionMenu |----->|OptionMenu |--->
  5596.                    +-----+-----+      +-----+-----+
  5597.  
  5598.  Programmer's Reference Guide       - 95 -         TEGL Windows Toolkit
  5599.  
  5600.  
  5601.  
  5602.  
  5603.  
  5604.                           Chapter 5 - Menus
  5605.  
  5606.                          |                  |
  5607.                          |------------------+
  5608.                          |
  5609.                          *
  5610.                    +-----------+
  5611.                    |OptionEntry|
  5612.                    +-----+-----+
  5613.                          *
  5614.  
  5615. OE is a short form for an optionentry structure. There is no limit
  5616. to the number of OE records that a list can contain, with the
  5617. exception that the number of entries cannot be greater than the size of
  5618. the screen when the OE list is displayed. This is a limitation of the
  5619. ListOptionMenu functions within the Menu unit and the screen vertical
  5620. size, rather then a maximum entry limitation. The ListOptionMenu
  5621. event could be modified to accommodate lists greater then the screen size
  5622. by displaying a portion of a list and adding another event to display the
  5623. remainder.
  5624.  
  5625. The OE record contains the entry (text) line, as well as information
  5626. on whether the entry line is active or inactive (place holder), its color,
  5627. and the event that is called when it is selected.
  5628.  
  5629.  
  5630.  
  5631. ___________________________________________________________________________
  5632.  
  5633. createoptionmenu                                                           
  5634. ___________________________________________________________________________
  5635.  
  5636.  
  5637. Function
  5638.                    Creates an Option Menu header.
  5639. Syntax
  5640.                    optionmptr createoptionmenu(fontptr fonttype);
  5641. Result type
  5642.                    Returns a Option Menu pointer type.
  5643. Remarks
  5644.                    fonttype is one of the fonts in the font library.
  5645.  
  5646.                    The option menu header is used to build and reference
  5647.                    the option entry list. Use this om pointer
  5648.                    when calling the function defineoptions.
  5649. Restrictions
  5650.                    To create multiple om headers with different fonts
  5651.                    on a single oe list, use createshadowom to
  5652.                    automatically create and link the oe list to a
  5653.                    new om header.
  5654. See also
  5655.                    defineoptions, createshadowom
  5656.  
  5657.  Programmer's Reference Guide       - 96 -         TEGL Windows Toolkit
  5658.  
  5659.  
  5660.  
  5661.  
  5662.  
  5663.                           Chapter 5 - Menus
  5664.  
  5665. Example
  5666.  
  5667.  
  5668.  
  5669.   optionmptr  om1, om2;
  5670.  
  5671.   om1 = createoptionmenu(font14);
  5672.  
  5673.   om2 = createoptionmenu(script);
  5674.  
  5675.  
  5676.  
  5677.  
  5678.  
  5679.  
  5680.  
  5681. ___________________________________________________________________________
  5682.  
  5683. defineoptions                                                              
  5684. ___________________________________________________________________________
  5685.  
  5686.  
  5687. Function
  5688.                    Adds Option Entries to an Option Menu.
  5689. Syntax
  5690.                    void defineoptions(optionmptr om, char *entrystr,
  5691.                      char active, callproc p); 
  5692. Remarks
  5693.                    The om pointer must be defined by 
  5694.                    createoptionmenu before option entries may be
  5695.                    added.
  5696.  
  5697.                    entrystr is the text string to be displayed when
  5698.                    the option menu is opened. The entrystr has two
  5699.                    types of control character which may be embedded as
  5700.                    part of the string. The q - is used to display a
  5701.                    dotted separator line between options. To underline a
  5702.                    character or a series of characters, add the value of
  5703.                    128 to the ascii value. The underline character is only
  5704.                    valid for characters that do not have descenders.
  5705.  
  5706.                    Active specifies whether this entry is active (can
  5707.                    be selected) or not active. Inactive entries are
  5708.                    displayed as jagged characters.
  5709.  
  5710.                    p defines the Event that is associated with
  5711.                    this menu entry. The p is attached automatically
  5712.                    to the option entry when the option menu is displayed.
  5713.  
  5714. Restrictions
  5715.  
  5716.  Programmer's Reference Guide       - 97 -         TEGL Windows Toolkit
  5717.  
  5718.  
  5719.  
  5720.  
  5721.  
  5722.                           Chapter 5 - Menus
  5723.  
  5724.                    There are no limitations on the number of entries that
  5725.                    can be defined under a single om header. However,
  5726.                    too many entries will list past the bottom of the screen.
  5727. See also
  5728.                    createoptionmenu, createshadowom, underlinechar
  5729.  
  5730. Example
  5731.  
  5732.  
  5733.  
  5734.   optionmptr  om1;
  5735.  
  5736.   om1 = createoptionmenu(font14);
  5737.   defineoptions(om1,"Desktop info...",TRUE,infooption);
  5738.   defineoptions(om1,"--",FALSE,NULL);
  5739.   defineoptions(om1,"Calculator",TRUE,NULL);
  5740.   defineoptions(om1,"Clock",TRUE,NULL);
  5741.   defineoptions(om1,"Snapshot",TRUE,NULL);
  5742.  
  5743.  
  5744.  
  5745.  
  5746.  
  5747.  
  5748.  
  5749. ___________________________________________________________________________
  5750.  
  5751. createshadowom                                                             
  5752. ___________________________________________________________________________
  5753.  
  5754.  
  5755. Function
  5756.                    Creates a duplicate Option Menu Header with a different
  5757.                    Font type.
  5758. Syntax
  5759.                    optionmptr createshadowom(optionmptr om,
  5760.                      fontptr fonttype);
  5761.  
  5762. Result type
  5763.                    Returns a new Option Menu pointer type.
  5764. Remarks
  5765.                    om must be an existing optionmenu pointer.
  5766.                    fonttype is one of the fonts in the font library.
  5767. Restrictions
  5768.                    The original om pointer must be defined by 
  5769.                    createoptionmenu before a duplicate option menu
  5770.                    header may be created.
  5771. See also
  5772.                    createoptionmenu, resizeoptionmenu
  5773. Example
  5774.  
  5775.  Programmer's Reference Guide       - 98 -         TEGL Windows Toolkit
  5776.  
  5777.  
  5778.  
  5779.  
  5780.  
  5781.                           Chapter 5 - Menus
  5782.  
  5783.  
  5784.  
  5785.  
  5786.  
  5787.   optionmptr  om1,om2;
  5788.  
  5789.   om1 = createoptionmenu(font14);
  5790.   defineoptions(om1,"Desktop info...",TRUE,infooption);
  5791.   defineoptions(om1,"--",FALSE,NULL);
  5792.   defineoptions(om1,"Calculator",TRUE,NULL);
  5793.   defineoptions(om1,"Clock",TRUE,NULL);
  5794.   defineoptions(om1,"Snapshot",TRUE,NULL);
  5795.  
  5796.   om2 = createshadowom(om1,script);
  5797.  
  5798.  
  5799.  
  5800.  
  5801.  
  5802.  
  5803.  
  5804. ___________________________________________________________________________
  5805.  
  5806. resizeoptionmenu                                                           
  5807. ___________________________________________________________________________
  5808.  
  5809.  
  5810. Function
  5811.                    Allows an Option Menu header to recalculate the
  5812.                    size of the option menu window when changing the font
  5813.                    type.
  5814. Syntax
  5815.                    void resizeoptionmenu(optionmptr om, fontptr fonttype);
  5816. Remarks
  5817.                    om must be an existing optionmenu pointer.
  5818.                    fonttype is one of the fonts in the font library.
  5819. See also
  5820.                    createoptionmenu, createshadowom
  5821. Example
  5822.  
  5823.  
  5824.  
  5825.  
  5826.   optionmptr  om1;
  5827.  
  5828.   om1 = createoptionmenu(font14);
  5829.   defineoptions(om1,"Desktop info...",TRUE,infooption);
  5830.   defineoptions(om1,"--",FALSE,NULL);
  5831.   defineoptions(om1,"Calculator",TRUE,NULL);
  5832.   defineoptions(om1,"Clock",TRUE,NULL);
  5833.  
  5834.  Programmer's Reference Guide       - 99 -         TEGL Windows Toolkit
  5835.  
  5836.  
  5837.  
  5838.  
  5839.  
  5840.                           Chapter 5 - Menus
  5841.  
  5842.   defineoptions(om1,"Snapshot",TRUE,NULL);
  5843.  
  5844.   resizeoptionmenu(om1,script);
  5845.   /* -- Changes the font type Font14 to Script */
  5846.  
  5847.  
  5848.  
  5849.  
  5850.  
  5851.  
  5852.  
  5853. ___________________________________________________________________________
  5854.  
  5855. togglecheckmark                                                            
  5856. ___________________________________________________________________________
  5857.  
  5858.  
  5859. Function
  5860.                    Changes the first character of an entry string to 0x30
  5861.                    (check mark) or a 0x32 (space).
  5862. Syntax
  5863.                    void togglecheckmark(unsigned omnum, unsigned oenum,
  5864.                      char status);
  5865. Remarks
  5866.                    omnum is the position of the option menu header
  5867.                    relative to the anchoromptr. oenum is the
  5868.                    position of the option entry relative to the om
  5869.                    header.
  5870.  
  5871.                    status of 1 will change the first character
  5872.                    of the entry to a checkmark, 0 will change the
  5873.                    character to a space.
  5874. See also
  5875.                    toggleentrystatus, replaceoptiontext
  5876. Example
  5877.  
  5878.  
  5879.  
  5880.   optionmptr  om1;
  5881.  
  5882.   om1 = createoptionmenu(font14);
  5883.   defineoptions(om1,"  Show as icons ",TRUE,viewoptiontoggle);
  5884.   defineoptions(om1,"  Show as text  ",TRUE,viewoptiontoggle);
  5885.   defineoptions(om1,"-",FALSE,NULL);
  5886.   defineoptions(om1,"  Sort by name  ",TRUE,viewoptiontoggle);
  5887.   defineoptions(om1,"  Sort by date  ",TRUE,viewoptiontoggle);
  5888.   defineoptions(om1,"  Sort by size  ",TRUE,viewoptiontoggle);
  5889.   defineoptions(om1,"  Sort by type  ",TRUE,viewoptiontoggle);
  5890.  
  5891.   togglecheckmark(1,7,TRUE);
  5892.  
  5893.  Programmer's Reference Guide       - 100 -         TEGL Windows Toolkit
  5894.  
  5895.  
  5896.  
  5897.  
  5898.  
  5899.                           Chapter 5 - Menus
  5900.  
  5901.   /* puts a check mark at the front of Sort by Type */
  5902.  
  5903.  
  5904.  
  5905.  
  5906.  
  5907.  
  5908.  
  5909. ___________________________________________________________________________
  5910.  
  5911. toggleentrystatus                                                          
  5912. ___________________________________________________________________________
  5913.  
  5914.  
  5915. Function
  5916.                    Sets an Option entry to active or not active.
  5917. Syntax
  5918.                    void toggleentrystatus(unsigned omnum, unsigned oenum,
  5919.                      char status);
  5920. Remarks
  5921.                    omnum is the position of the option menu header
  5922.                    relative to the anchoromptr.
  5923.  
  5924.                    oenum is the position of the option entry relative
  5925.                    to the om header.
  5926.  
  5927.                    status of 1 will set the entry as active, 0 will
  5928.                    set the entry to nonactive. active specifies
  5929.                    whether this entry is active (can be selected) or
  5930.                    nonactive. Nonactive entries are displayed as jagged
  5931.                    characters.
  5932.  
  5933. See also
  5934.                    togglecheckmark, replaceoptiontext
  5935. Example
  5936.  
  5937.  
  5938.  
  5939.   optionmptr  om1;
  5940.  
  5941.   om1 = createoptionmenu(font14);
  5942.   defineoptions(om1,"Desktop info...",TRUE,infooption);
  5943.   defineoptions(om1,"--",FALSE,NULL);
  5944.   defineoptions(om1,"Calculator",TRUE,NULL);
  5945.   defineoptions(om1,"Clock",TRUE,NULL);
  5946.   defineoptions(om1,"Snapshot",TRUE,NULL);
  5947.  
  5948.   toggleentrystatus(1,5,FALSE);  /* toggles snapshot off */
  5949.  
  5950.  
  5951.  
  5952.  Programmer's Reference Guide       - 101 -         TEGL Windows Toolkit
  5953.  
  5954.  
  5955.  
  5956.  
  5957.  
  5958.                           Chapter 5 - Menus
  5959.  
  5960.  
  5961.  
  5962.  
  5963.  
  5964.  
  5965. ___________________________________________________________________________
  5966.  
  5967. replaceoptiontext                                                          
  5968. ___________________________________________________________________________
  5969.  
  5970.  
  5971. Function
  5972.                    Replaces Option entry string by another text string.
  5973. Syntax
  5974.                    void replaceoptiontext(unsigned omnum, unsigned oenum,
  5975.                      char *entrystr);
  5976. Remarks
  5977.                    omnum is the position of the option menu header
  5978.                    relative to the anchoromptr.
  5979.  
  5980.                    oenum is the position of the option entry relative
  5981.                    to the om header.
  5982.  
  5983.                    entrystr is a replacement text string that will be
  5984.                    displayed when the Option menu is opened. The 
  5985.                    entrystr has two types of control character which may
  5986.                    be embedded as part of the string. The q - is used to
  5987.                    display a dotted separator line between options. To
  5988.                    underline a character or a series of characters, add
  5989.                    the value of 128 to the ascii value. The underline
  5990.                    character only works with characters that do not have
  5991.                    descenders.
  5992.  
  5993. See also
  5994.                    togglecheckmark, toggleentrystatus
  5995. Example
  5996.  
  5997.  
  5998.  
  5999.   optionmptr  om1;
  6000.  
  6001.   om1 = createoptionmenu(font14);
  6002.   defineoptions(om1,"Desktop info...",TRUE,infooption);
  6003.   defineoptions(om1,"--",FALSE,NULL);
  6004.   defineoptions(om1,"Calculator",TRUE,NULL);
  6005.   defineoptions(om1,"Clock",TRUE,NULL);
  6006.   defineoptions(om1,"Snapshot",TRUE,NULL);
  6007.  
  6008.   /* -- Replaces "Snapshot" with "Picture" */
  6009.   replaceoptiontext(1,5,"Picture");
  6010.  
  6011.  Programmer's Reference Guide       - 102 -         TEGL Windows Toolkit
  6012.  
  6013.  
  6014.  
  6015.  
  6016.  
  6017.                           Chapter 5 - Menus
  6018.  
  6019.  
  6020.  
  6021.  
  6022.  
  6023.  
  6024.  
  6025. ___________________________________________________________________________
  6026.  
  6027. toggleoptionbar                                                            
  6028. ___________________________________________________________________________
  6029.  
  6030.  
  6031. Function
  6032.                    Inverts mouse click areas.
  6033. Syntax
  6034.                    void toggleoptionbar(imagestkptr ifs, msclickptr,
  6035.                      opt, msclickptr lastopt);
  6036. Remarks
  6037.                    opt and lastopt mouse click areas are
  6038.                    inverted. It is assumed that lastopt has
  6039.                    already been inverted and this call would return
  6040.                    it to normal.
  6041.  
  6042.  
  6043.  
  6044.  
  6045. ___________________________________________________________________________
  6046.  
  6047. setoptionmenucolors                                                        
  6048. ___________________________________________________________________________
  6049.  
  6050.  
  6051. Function
  6052.                    Changes the menu entry colors.
  6053. Syntax
  6054.                    Macro
  6055.                    setoptionmenucolors(unsigned activecolor,
  6056.                      unsigned inactivecolor);
  6057. Remarks
  6058.                    activecolor is the text color for active entries.
  6059.  
  6060.                    inactivecolor is the text color for entries that
  6061.                    are currently inactive but have entry positions within
  6062.                    the menu.
  6063. See also
  6064.                    setoptionmenubordercolor
  6065. Example
  6066.  
  6067.  
  6068.   setoptionmenucolors(BLACK,LIGHTGRAY);
  6069.  
  6070.  Programmer's Reference Guide       - 103 -         TEGL Windows Toolkit
  6071.  
  6072.  
  6073.  
  6074.  
  6075.  
  6076.                           Chapter 5 - Menus
  6077.  
  6078.  
  6079.  
  6080.  
  6081.  
  6082.  
  6083. ___________________________________________________________________________
  6084.  
  6085. setoptionmenubordercolor                                                   
  6086. ___________________________________________________________________________
  6087.  
  6088.  
  6089. Function
  6090.                    Changes the color of the option menu border.
  6091. Syntax
  6092.                    Macro
  6093.                    void setoptionmenubordercolors(unsigned color);
  6094. Remarks
  6095.                    color is the color of the border.
  6096. See also
  6097.                    setoptionmenucolors
  6098. Example
  6099.  
  6100.  
  6101.   setoptionmenubordercolor(WHITE);
  6102.  
  6103.  
  6104.  
  6105.  
  6106.  
  6107. ___________________________________________________________________________
  6108.  
  6109. sethidesubmenu                                                             
  6110. ___________________________________________________________________________
  6111.  
  6112.  
  6113.  
  6114. Function
  6115.                    Toggles the hiding of sub menus.
  6116. Syntax
  6117.                    void sethidesubmenu(char onoff);
  6118. Remarks
  6119.                    Default is true. When a submenu is pulled down from a
  6120.                    bar menu it is normally hidden when a selection is
  6121.                    made. If set to 0 then the pulldown is left displayed
  6122.                    until the selection that was made returns.
  6123. Example
  6124.  
  6125.  
  6126.   sethidesubmenu(TRUE);
  6127.  
  6128.  
  6129.  Programmer's Reference Guide       - 104 -         TEGL Windows Toolkit
  6130.  
  6131.  
  6132.  
  6133.  
  6134.  
  6135.                           Chapter 5 - Menus
  6136.  
  6137.  
  6138.  
  6139.  
  6140.  
  6141. Creating a Bar Menu
  6142.  
  6143. A bar menu is one of the more popular methods of creating a user interface.
  6144. As mentioned before, a bar menu is simply another event with the event
  6145. handler set to baroptionmenu. baroptionmenu is activated
  6146. whenever the mouse cursor passes by the one of the defined mouse click
  6147. areas on the bar.
  6148.  
  6149. when baroptionmenu is activated, optionmenuselection is called
  6150. in place of the teglsupervisor.
  6151.  
  6152. There are three activities within a menu system that require a rewrite of
  6153. the teglsupervisor. optionmenuselection checks if
  6154.  
  6155.  
  6156.      The mouse is clicked outside the menu bar or menu window thus closing
  6157.      any active menus and returning back to the TEGL supervisor.
  6158.  
  6159.      Sensing the mouse cursor movement to another bar entry, thus closing
  6160.      any active menu and opening another menu window.
  6161.  
  6162.      Sensing the mouse cursor moving to another entry within a menu and
  6163.      highlighting the entry.
  6164.  
  6165.  
  6166.  
  6167. ___________________________________________________________________________
  6168.  
  6169. createbarmenu                                                              
  6170. ___________________________________________________________________________
  6171.  
  6172.  
  6173. Function
  6174.                    Creates a Bar window frame.
  6175. Syntax
  6176.                    void createbarmenu(unsigned x, unsigned y,
  6177.                      unsigned ln);
  6178. Remarks
  6179.                    x, y is the position of the bar menu frame.
  6180.  
  6181.                    ln is the pixel length of the bar.
  6182. See also
  6183.                    outbaroption
  6184. Example
  6185.  
  6186.  
  6187.  
  6188.  Programmer's Reference Guide       - 105 -         TEGL Windows Toolkit
  6189.  
  6190.  
  6191.  
  6192.  
  6193.  
  6194.                           Chapter 5 - Menus
  6195.  
  6196.   createbarmenu(0,0,getmaxx);
  6197.  
  6198.  
  6199.  
  6200.  
  6201.  
  6202.  
  6203. ___________________________________________________________________________
  6204.  
  6205. outbaroption                                                               
  6206. ___________________________________________________________________________
  6207.  
  6208.  
  6209. Function
  6210.                    Attaches an option menu (list) to a displayed text
  6211.                    string on the BAR.
  6212. Syntax
  6213.                    void outbaroption(char *entrystr, optionmptr om);
  6214. Remarks
  6215.                    entrystr is the bar text header that is associated
  6216.                    with the om list.
  6217.  
  6218.                    om is the option menu header returned from
  6219.                    createoptionmenu.
  6220. See also
  6221.                    createbarmenu
  6222. Example
  6223.  
  6224.  
  6225.  
  6226.   optionmptr  om1;
  6227.  
  6228.   om1 = createoptionmenu(font14);
  6229.   defineoptions(om1,"  Show as icons ",TRUE,viewoptiontoggle);
  6230.   defineoptions(om1,"  Show as text  ",TRUE,viewoptiontoggle);
  6231.   defineoptions(om1,"-",FALSE,NULL);
  6232.   defineoptions(om1,"  Sort by name  ",TRUE,viewoptiontoggle);
  6233.   defineoptions(om1,"  Sort by date  ",TRUE,viewoptiontoggle);
  6234.   defineoptions(om1,"  Sort by size  ",TRUE,viewoptiontoggle);
  6235.   defineoptions(om1,"  Sort by type  ",TRUE,viewoptiontoggle);
  6236.  
  6237.   createbarmenu(0,0,getmaxx);
  6238.   outbaroption(" Options ",om1);
  6239.  
  6240.  
  6241.  
  6242.  
  6243.  
  6244. ___________________________________________________________________________
  6245.  
  6246.  
  6247.  Programmer's Reference Guide       - 106 -         TEGL Windows Toolkit
  6248.  
  6249.  
  6250.  
  6251.  
  6252.  
  6253.                           Chapter 5 - Menus
  6254.  
  6255. setbartextcolor                                                            
  6256. ___________________________________________________________________________
  6257.  
  6258.  
  6259. Function
  6260.                    Changes the default text color on the bar.
  6261. Syntax
  6262.                    Macro
  6263.                    void setbartextcolor(unsigned color);
  6264. Remarks
  6265.                    color is the default text color on the bar.
  6266. See also
  6267.                    setbarmenucolor, setbarbordercolor
  6268. Example
  6269.  
  6270.  
  6271.   setbartextcolor(GREEN);
  6272.  
  6273.  
  6274.  
  6275.  
  6276.  
  6277. ___________________________________________________________________________
  6278.  
  6279. setbarmenucolor                                                            
  6280. ___________________________________________________________________________
  6281.  
  6282.  
  6283. Function
  6284.                    Changes the bar color.
  6285. Syntax
  6286.                    Macro
  6287.                    void setbarmenucolor(unsigned color);
  6288. Remarks
  6289.                    color is the default color for the bar.
  6290. See also
  6291.                    setbarmenucolor, setbarbordercolor
  6292. Example
  6293.  
  6294.  
  6295.   setbarmenucolor(BLUE);
  6296.  
  6297.  
  6298.  
  6299.  
  6300.  
  6301. ___________________________________________________________________________
  6302.  
  6303. setbarbordercolor                                                          
  6304. ___________________________________________________________________________
  6305.  
  6306.  Programmer's Reference Guide       - 107 -         TEGL Windows Toolkit
  6307.  
  6308.  
  6309.  
  6310.  
  6311.  
  6312.                           Chapter 5 - Menus
  6313.  
  6314.  
  6315.  
  6316. Function
  6317.                    Changes the bar border color and toggles the border on.
  6318. Syntax
  6319.                    Macro
  6320.                    void setbarbordercolor(unsigned color);
  6321. Remarks
  6322.                    color is the default border color for the bar.
  6323. See also
  6324.                    setbartextcolor, setbarborderoff
  6325. Example
  6326.  
  6327.  
  6328.   setbarbordercolor(GREEN);
  6329.  
  6330.  
  6331.  
  6332.  
  6333.  
  6334. ___________________________________________________________________________
  6335.  
  6336. setbarborderoff                                                            
  6337. ___________________________________________________________________________
  6338.  
  6339.  
  6340. Function
  6341.                    Toggles the bar border off.
  6342. Syntax
  6343.                    Macro
  6344.                    void setbarborderoff(void);
  6345. Remarks
  6346.                    setbarbordercolor resets the border on.
  6347. See also
  6348.                    setbarbordercolor, setbartextcolor
  6349. Example
  6350.  
  6351.  
  6352.   setbarborderoff(void);
  6353.  
  6354.  
  6355.  
  6356.  
  6357.  
  6358. ___________________________________________________________________________
  6359.  
  6360. setbarshadowtext                                                           
  6361. ___________________________________________________________________________
  6362.  
  6363.  
  6364.  
  6365.  Programmer's Reference Guide       - 108 -         TEGL Windows Toolkit
  6366.  
  6367.  
  6368.  
  6369.  
  6370.  
  6371.                           Chapter 5 - Menus
  6372.  
  6373. Function
  6374.                    Toggles Bar Shadow Text on/off.
  6375. Syntax
  6376.                    Macro
  6377.                    void setbarshadowtext(char onoff)
  6378. Remarks
  6379.                    onoff is either 1 for on and 0 for off.
  6380. Example
  6381.  
  6382.  
  6383.   setbarshadowtext(TRUE);
  6384.  
  6385.  
  6386.  
  6387.  
  6388.  
  6389. ___________________________________________________________________________
  6390.  
  6391. setbarfillstyle                                                            
  6392. ___________________________________________________________________________
  6393.  
  6394.  
  6395. Function
  6396.                    Sets the Bar Fill Style.
  6397. Syntax
  6398.                    Macro
  6399.                    void setbarfillstyle(unsigned pattern);
  6400. Remarks
  6401.                    Sets the pattern for the bar. The fill patterns are
  6402.                    defined by constants in graphics.h.
  6403.  
  6404.                    pattern is a numeric type.
  6405. See also
  6406.                    setfillstyle graphics.h.
  6407. Example
  6408.  
  6409.  
  6410.   setbarfillstyle(BKSLASH_FILL);
  6411.  
  6412.  
  6413.  
  6414.  
  6415.  
  6416. ___________________________________________________________________________
  6417.  
  6418. setbarmenumargin                                                           
  6419. ___________________________________________________________________________
  6420.  
  6421.  
  6422.  
  6423.  
  6424.  Programmer's Reference Guide       - 109 -         TEGL Windows Toolkit
  6425.  
  6426.  
  6427.  
  6428.  
  6429.  
  6430.                           Chapter 5 - Menus
  6431.  
  6432. Function
  6433.                    Sets the left margin on the barmenu.
  6434. Syntax
  6435.                    Macro
  6436.                    void setbarmenumargin(unsigned margin);
  6437. Remarks
  6438.                    margin is the desired left margin where the menu
  6439.                    selections start at. This value is in pixels and the
  6440.                    default is 16.
  6441.  
  6442.                    Can be used if a icon or some symbol should be displayed
  6443.                    at the extreme left of the menu.
  6444. Example
  6445.  
  6446.  
  6447.   setbarmenumargin(32);
  6448.  
  6449.  
  6450.  
  6451.  
  6452.  
  6453. Icon Option Menus
  6454.  
  6455. Optionally you can attach a menu to an icon or an area of a frame.
  6456.  
  6457. The following function adds a drop down menu to any frame area.
  6458.  
  6459.  
  6460. ___________________________________________________________________________
  6461.  
  6462. defineoptionclickarea                                                      
  6463. ___________________________________________________________________________
  6464.  
  6465.  
  6466. Function
  6467.                    Attaches an option menu (list) to a frame or icon area.
  6468. Syntax
  6469.                    void defineoptionclickarea(imagestkptr ifs,
  6470.                      unsigned x, unsigned y, unsigned x1, unsigned y1,
  6471.                        optionmptr om, char sense, unsigned char omtype);
  6472. Remarks
  6473.                    ifs is any imagestkptr. x, y, x1, y1 are
  6474.                    coordinates relative to a frame.  This means that the
  6475.                    upper left corner of a frame is considered 0,0.
  6476.  
  6477.                    om is the option menu header returned from
  6478.                    createoptionmenu.
  6479.  
  6480.                    sense is either MSSENSE or MSCLICK. MSSENSE
  6481.                    activates the menu event handler whenever the mouse
  6482.  
  6483.  Programmer's Reference Guide       - 110 -         TEGL Windows Toolkit
  6484.  
  6485.  
  6486.  
  6487.  
  6488.  
  6489.                           Chapter 5 - Menus
  6490.  
  6491.                    cursor passes over the defined mouse click areas. 
  6492.                    MSCLICK requires the right mouse button to be pressed
  6493.                    while the mouse cursor is on the mouse click area.
  6494.  
  6495.                    omtype is the enumerated type of UPPERRIGHT,
  6496.                    UPPERLEFT, LOWERRIGHT, and LOWERLEFT, which specifies
  6497.                    whether the menu pop-down at the upper right or upper
  6498.                    left corner, or pop-up at the lower right or lower left
  6499.                    corner.
  6500. See also
  6501.                    definemouseclickarea, resetoptionmenuevents
  6502. Example
  6503.  
  6504.  
  6505.  
  6506.   optionmptr  om1;
  6507.  
  6508.   om1 = createoptionmenu(font14);
  6509.   defineoptions(om1,"  Show as icons ",TRUE,viewoptiontoggle);
  6510.   defineoptions(om1,"  Show as text  ",TRUE,viewoptiontoggle);
  6511.   defineoptions(om1,"-",FALSE,NULL);
  6512.   defineoptions(om1,"  Sort by name  ",TRUE,viewoptiontoggle);
  6513.   defineoptions(om1,"  Sort by date  ",TRUE,viewoptiontoggle);
  6514.   defineoptions(om1,"  Sort by size  ",TRUE,viewoptiontoggle);
  6515.   defineoptions(om1,"  Sort by type  ",TRUE,viewoptiontoggle);
  6516.  
  6517.   pushimage(530,320,624,340);
  6518.   putpict(530,320,imageCREDITS,BLACK);
  6519.   defineoptionclickarea(stackptr,0,0,93,19,om1,MSCLICK,LOWERRIGHT);
  6520.  
  6521.  
  6522.  
  6523.  
  6524.  
  6525.  
  6526. ___________________________________________________________________________
  6527.  
  6528. resetoptionmenuevents                                                      
  6529. ___________________________________________________________________________
  6530.  
  6531.  
  6532. Function
  6533.                    Eliminates duplicate menu events where the frame has
  6534.                    been closed.
  6535. Syntax
  6536.                    void resetoptionmenuevents(void);
  6537. Remarks
  6538.                    The Menu unit keeps track of menu to frame attachments.
  6539.                    In most cases the attachment is permanent, that is,
  6540.                    until the program terminates. However in some cases,
  6541.  
  6542.  Programmer's Reference Guide       - 111 -         TEGL Windows Toolkit
  6543.  
  6544.  
  6545.  
  6546.  
  6547.  
  6548.                           Chapter 5 - Menus
  6549.  
  6550.                    like the icon editor, the menu to frame attachment
  6551.                    changes every time the icon editor explodes or implodes
  6552.                    an icon image. Since the Menu unit has no way of
  6553.                    knowing whether the attachment still exists, a special
  6554.                    function was created to eliminate duplicate or
  6555.                    nonexistent event relationships.
  6556.  
  6557.                    The only problem with not calling ResetOptionMenuEvents
  6558.                    would be an accumulation of menu events for
  6559.                    non-existing frames. Eventually the heap area will
  6560.                    overflow.
  6561. See also
  6562.                    defineoptionclickarea
  6563. Example
  6564.  
  6565.  
  6566.  
  6567.   optionmptr  om1;
  6568.  
  6569.   om1 = createoptionmenu(font14);
  6570.   defineoptions(om1,"  Show as icons ",TRUE,viewoptiontoggle);
  6571.   defineoptions(om1,"  Show as text  ",TRUE,viewoptiontoggle);
  6572.   defineoptions(om1,"-",FALSE,NULL);
  6573.   defineoptions(om1,"  Sort by name  ",TRUE,viewoptiontoggle);
  6574.   defineoptions(om1,"  Sort by date  ",TRUE,viewoptiontoggle);
  6575.   defineoptions(om1,"  Sort by size  ",TRUE,viewoptiontoggle);
  6576.   defineoptions(om1,"  Sort by type  ",TRUE,viewoptiontoggle);
  6577.  
  6578.   pushimage(530,320,624,340);
  6579.   putpict(530,320,imageCREDITS,BLACK);
  6580.   defineoptionclickarea(stackptr,0,0,93,19,om1,MSCLICK,LOWERRIGHT);
  6581.   popimage();
  6582.  
  6583.   pushimage(530,320,624,340);
  6584.   putpict(530,320,imageCREDITS,BLACK);
  6585.   defineoptionclickarea(stackptr,0,0,93,19,om1,MSCLICK,LOWERRIGHT);
  6586.   resetoptionmenuevents();
  6587.  
  6588.  
  6589.  
  6590.  
  6591.  
  6592.  
  6593.  
  6594.  
  6595.  
  6596.  
  6597.  
  6598.  
  6599.  
  6600.  
  6601.  Programmer's Reference Guide       - 112 -         TEGL Windows Toolkit
  6602.  
  6603.  
  6604.  
  6605.  
  6606.  
  6607.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  6608.  
  6609.  
  6610. Interrupt Handlers (TEGLIntr)
  6611. ___________________________________________________________________________
  6612.  
  6613. The mouse is perhaps one of the most outlandish devices ever conceived as
  6614. an interface for computer system (at least in programming it). However, in
  6615. the world of GUI, the mouse is a mandatory device.
  6616.  
  6617. Programming for a mouse is a programmer's nightmare, simply because it
  6618. adds another level of interfacing.  Conceptually, keyboard and mice do not
  6619. mix.  As an example, the mouse is dependent on screen location and whether
  6620. the user had clicked the mouse at a specific location on the screen and
  6621. whether that location was on an icon.  The keyboard, on the other hand, is
  6622. almost a direct path between pressing a key and executing a subroutine
  6623. (i.e. if keypress then do something).
  6624.  
  6625. The programmer is required to write two separate routines for the same
  6626. function to handle this mix of interfaces. As well, some systems do not
  6627. have a mouse, so you cannot rely on the mouse pointer being available on
  6628. all systems.
  6629.  
  6630. TEGL Windows Toolkit, of  course, provides an almost seamless integration
  6631. of the two devices. On systems without a mouse, TEGL will emulate the
  6632. mouse by using the cursor keys on the numeric keypad. On systems with a
  6633. mouse, the cursor keys may be used simultaneously to move the mouse cursor
  6634. around. A key may also be attached to an icon/event, having the same
  6635. effect as the mouse clicking on the icon.
  6636.  
  6637.  
  6638. Interrupts
  6639. The TEGLIntr unit is comprised of four captured interrupts: The keyboard
  6640. interrupt (int $09), the mouse subroutine interrupt (function 12), the
  6641. timer interrupt (int $08) and the control break handler (int $1B).
  6642.  
  6643. swapteglintroff and swapteglintron should be called just before
  6644. and after a call to spawn to restore and then to recapture interrupt
  6645. vectors.
  6646.  
  6647.  
  6648. ___________________________________________________________________________
  6649.  
  6650. swapteglintroff                                                            
  6651. ___________________________________________________________________________
  6652.  
  6653.  
  6654. Function
  6655.                    Restores all interrupts to the original saved vectors.
  6656. Syntax
  6657.                    void swapteglintroff(void)
  6658. Remarks
  6659.  
  6660.  Programmer's Reference Guide       - 113 -         TEGL Windows Toolkit
  6661.  
  6662.  
  6663.  
  6664.  
  6665.  
  6666.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  6667.  
  6668.                    All interrupts are initially turned on.
  6669. See also
  6670.                    swapteglintron
  6671.  
  6672.  
  6673.  
  6674. ___________________________________________________________________________
  6675.  
  6676. swapteglintron                                                             
  6677. ___________________________________________________________________________
  6678.  
  6679.  
  6680. Function
  6681.                    Saves and initialize the required TEGL interrupts.
  6682. Syntax
  6683.                    void swapteglintron(void)
  6684. Restrictions
  6685.                    swapteglintron cannot be called more then once in
  6686.                    succession, otherwise the system will hang.
  6687. See also
  6688.                    swapteglintron
  6689.  
  6690. Mouse Emulation
  6691.  
  6692. The mouse cursor is an internal function of the TEGL mouse unit, rather
  6693. than using the cursor provided by the mouse driver. This way a mouse
  6694. cursor is always available even on systems that do not have a mouse.
  6695.  
  6696. The support for the emulated mouse is identical, in all respects, to the
  6697. actual mouse driver.
  6698.  
  6699. In order to provide a seamless integration of the mouse and keyboard,
  6700. the Mouse function 12 interrupt $33 is used to capture the mouse hardware
  6701. interrupts, and keyboard interrupt $09 is used to capture key codes.
  6702. Since both are hardware interrupts, a kbmousebusy flag is used to
  6703. serialize any conflict if both interrupts occurs at the same time.
  6704.  
  6705. The emulated mouse cursor is controled by the following primitives. They
  6706. may be used ONLY if the mouseshow flag is FALSE, otherwise
  6707. you may find mouse droppings on the screen.
  6708.  
  6709.  
  6710. ___________________________________________________________________________
  6711.  
  6712. mcursoroff                                                                 
  6713. ___________________________________________________________________________
  6714.  
  6715.  
  6716. Function
  6717.                    Switches the Emulated Mouse Cursor off.
  6718.  
  6719.  Programmer's Reference Guide       - 114 -         TEGL Windows Toolkit
  6720.  
  6721.  
  6722.  
  6723.  
  6724.  
  6725.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  6726.  
  6727. Syntax
  6728.                    void mcursoroff(void)
  6729. Restrictions
  6730.                    Use ONLY when mouseshow flag is FALSE.
  6731. See also
  6732.                    mcursoron, msetpos
  6733.  
  6734.  
  6735.  
  6736. ___________________________________________________________________________
  6737.  
  6738. mcursoron                                                                  
  6739. ___________________________________________________________________________
  6740.  
  6741.  
  6742. Function
  6743.                    Switches the Emulated Mouse Cursor on.
  6744. Syntax
  6745.                    void mcursoron(unsigned xpos, unsigned ypos);
  6746. Remarks
  6747.                    xpos, ypos is the relative screen coordinates from
  6748.                    the upper left corner of 0,0.
  6749. Restrictions
  6750.                    Use ONLY when mouseshow flag is FALSE.
  6751. See also
  6752.                    mcursoroff, msetpos
  6753.  
  6754.  
  6755.  
  6756. ___________________________________________________________________________
  6757.  
  6758. msetpos                                                                    
  6759. ___________________________________________________________________________
  6760.  
  6761.  
  6762. Function
  6763.                    Sets a new position for the Emulated Mouse Cursor.
  6764. Syntax
  6765.                    void msetpos(unsigned xpos, unsigned ypos);
  6766. Remarks
  6767.                    xpos, ypos is the relative screen coordinates from
  6768.                    the upper left corner of 0,0.
  6769. Restrictions
  6770.                    The emulated mouse cursor must be on before setting a
  6771.                    new position.
  6772.  
  6773.                    Use ONLY when mouseshow flag is FALSE.
  6774. See also
  6775.                    mcursoroff, mcursoron
  6776.  
  6777.  
  6778.  Programmer's Reference Guide       - 115 -         TEGL Windows Toolkit
  6779.  
  6780.  
  6781.  
  6782.  
  6783.  
  6784.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  6785.  
  6786.  
  6787.  
  6788. Standard Mouse Functions
  6789.  
  6790.  
  6791. ___________________________________________________________________________
  6792.  
  6793. showmouse                                                                  
  6794. ___________________________________________________________________________
  6795.  
  6796.  
  6797. Function
  6798.                    display a mouse cursor at current mouse_xcoord,
  6799.                    mouse_ycoord.
  6800. Syntax
  6801.                    void showmouse(void);
  6802. See also
  6803.                    hidemouse, setmouseposition, cursorshape
  6804.  
  6805.  
  6806.  
  6807. ___________________________________________________________________________
  6808.  
  6809. hidemouse                                                                  
  6810. ___________________________________________________________________________
  6811.  
  6812.  
  6813. Function
  6814.                    Hides mouse cursor.
  6815. Syntax
  6816.                    void hidemouse(void)
  6817. See also
  6818.                    showmouse, setmouseposition, cursorshape
  6819.  
  6820.  
  6821.  
  6822. ___________________________________________________________________________
  6823.  
  6824. setmouseposition                                                           
  6825. ___________________________________________________________________________
  6826.  
  6827.  
  6828. Function
  6829.                    Sets x,y coordinates of mouse cursor.
  6830. Syntax
  6831.                    void setmouseposition(unsigned mousex, unsigned mousey)
  6832. Remarks
  6833.                    mousex, mousey are relative coordinates from the
  6834.                    upper left corner of the screen 0,0.
  6835. See also
  6836.  
  6837.  Programmer's Reference Guide       - 116 -         TEGL Windows Toolkit
  6838.  
  6839.  
  6840.  
  6841.  
  6842.  
  6843.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  6844.  
  6845.                    showmouse, hidemouse, cursorshape
  6846.  
  6847.  
  6848.  
  6849. ___________________________________________________________________________
  6850.  
  6851. cursorshape                                                                
  6852. ___________________________________________________________________________
  6853.  
  6854.  
  6855. Function
  6856.                    Sets the mouse cursor shape.
  6857. Syntax
  6858.                    void cursorshape(masktype shape)
  6859. Remarks
  6860.                    Sets the mouse cursor shape to the bit pattern
  6861.                    specified in shape.
  6862.  
  6863.                    masktype is predefined as follows:
  6864.  
  6865.  
  6866.    typedef
  6867.        unsigned masktype [2][16];
  6868.  
  6869.  
  6870.  
  6871. The mouse shape is based on the underlying byte values contained in the
  6872. shape array. the shape array is 64 bytes long, with the first
  6873. 32 bytes corresponding to a 16 by 16 screen mask, and the remaining 32
  6874. bytes corresponding to a 16 by 16 cursor mask. The first 32 bytes are
  6875. ANDed to the screen, followed by ORing the second 32 bytes
  6876. with the screen pixels to create the final mouse image.
  6877.  
  6878. For example the pointinghand masktype is defined as a constant as
  6879. follows:
  6880.  
  6881.  
  6882.  
  6883.   masktype pointinghand
  6884.    /* Screen Mask  */
  6885.   = {{0xE1FF, 0xE1FF, 0xE1FF, 0xE1FF, 0xE1ff, 0xE000, 0xE000, 0xe000,
  6886.       0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
  6887.    /* Cursor Mask  */
  6888.      {0x1E00, 0x1200, 0x1200, 0x1200, 0x1200, 0x13ff, 0x1249, 0x1249,
  6889.       0x1249, 0x9001, 0x9001, 0x9001, 0x8001, 0x8001, 0x8001, 0xFFFF}};
  6890.  
  6891.  
  6892.  
  6893. The resulting type is:
  6894.  
  6895.  
  6896.  Programmer's Reference Guide       - 117 -         TEGL Windows Toolkit
  6897.  
  6898.  
  6899.  
  6900.  
  6901.  
  6902.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  6903.  
  6904.            Screen Mask
  6905.  
  6906.            1110000111111111     =  0xE1FF
  6907.            1110000111111111     =  0xE1FF
  6908.            1110000111111111     =  0xE1FF
  6909.            1110000111111111     =  0xE1FF
  6910.            1110000111111111     =  0xE1FF
  6911.            1110000000000000     =  0xE100
  6912.            1110000000000000     =  0xE100
  6913.            1110000000000000     =  0xE100
  6914.            0000000000000000     =  0x0000
  6915.            0000000000000000     =  0x0000
  6916.            0000000000000000     =  0x0000
  6917.            0000000000000000     =  0x0000
  6918.            0000000000000000     =  0x0000
  6919.            0000000000000000     =  0x0000
  6920.            0000000000000000     =  0x0000
  6921.            0000000000000000     =  0x0000
  6922.  
  6923.  
  6924.            Cursor Mask
  6925.  
  6926.            0001111000000000     =  0x1E00
  6927.            0001001000000000     =  0x1200
  6928.            0001001000000000     =  0x1200
  6929.            0001001000000000     =  0x1200
  6930.            0001001000000000     =  0x1200
  6931.            0001001111111111     =  0x13FF
  6932.            0001001001001001     =  0x1249
  6933.            0001001001001001     =  0x1249
  6934.            0001001001001001     =  0x1249
  6935.            1001000000000001     =  0x9001
  6936.            1001000000000001     =  0x9001
  6937.            1000000000000001     =  0x8001
  6938.            1000000000000001     =  0x8001
  6939.            1000000000000001     =  0x8001
  6940.            1000000000000001     =  0x8001
  6941.            1111111111111111     =  0xFFFF
  6942.  
  6943.  
  6944. There are 5 masktype constants defined in the teglntr.c module. They
  6945. are: pointinghand, hourglass, standard, diagcross, and checkmark.
  6946.  
  6947. See also
  6948.                    showmouse, hidemouse, setmousehotspot
  6949.  
  6950.  
  6951.  
  6952. ___________________________________________________________________________
  6953.  
  6954.  
  6955.  Programmer's Reference Guide       - 118 -         TEGL Windows Toolkit
  6956.  
  6957.  
  6958.  
  6959.  
  6960.  
  6961.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  6962.  
  6963. setmousehotspot                                                            
  6964. ___________________________________________________________________________
  6965.  
  6966.  
  6967. Function
  6968.                    Sets the cursor hot-spot values relative to the
  6969.                    upper-left corner of the mouse cursor image.
  6970. Syntax
  6971.                    void setmousehotspot(unsigned x,unsigned y);
  6972. Remarks
  6973.                    x, y are relative coordinates from the upper left
  6974.                    corner of the mouse cursor image 0,0.
  6975. See also
  6976.                    cursorshape
  6977.  
  6978.  
  6979.  
  6980. ___________________________________________________________________________
  6981.  
  6982. setmousecolor                                                              
  6983. ___________________________________________________________________________
  6984.  
  6985.  
  6986. Function
  6987.                    Sets the mouse cursor color.
  6988. Syntax
  6989.                    void setmousecolor(unsigned color);
  6990. Remarks
  6991.                    Sets the current Mouse Cursor Color to color.
  6992.                    Available colors are defined in graphics.h.
  6993. See also
  6994.                    cursorshape
  6995.  
  6996.  
  6997.  
  6998. ___________________________________________________________________________
  6999.  
  7000. mouseposition                                                              
  7001. ___________________________________________________________________________
  7002.  
  7003.  
  7004. Function
  7005.                    Gets the Mouse Cursor coordinates and button
  7006.                    information.
  7007. Syntax
  7008.                    unsigned mouseposition(unsigned *mousex,
  7009.                      unsigned *mousey);
  7010. Result type
  7011.                    Returns the mouse button status. Left button - 1, Right
  7012.                    button - 2, both buttons - 3.
  7013.  
  7014.  Programmer's Reference Guide       - 119 -         TEGL Windows Toolkit
  7015.  
  7016.  
  7017.  
  7018.  
  7019.  
  7020.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  7021.  
  7022. Remarks
  7023.                    mousex,mousey are relative coordinates from the
  7024.                    upper left corner of the screen (0,0).
  7025.  
  7026.                    This function is no longer required in version II,
  7027.                    since the the information above are provided in the
  7028.                    global variables mouse_xcoord, mouse_ycoord and
  7029.                    mouse_buttons respectively.
  7030. See also
  7031.                    getbuttonreleaseinfo, getbuttonpressinfo,
  7032.                    clearbuttoninfo
  7033. Example
  7034.  
  7035.  
  7036.  
  7037.   unsigned mp,x,y;
  7038.  
  7039.   mp = mouseposition(x,y);
  7040.   if (mp = 3)    /* -- both buttons down */
  7041.     {
  7042.     }
  7043.  
  7044.  
  7045.  
  7046.  
  7047.  
  7048. ___________________________________________________________________________
  7049.  
  7050. getbuttonreleaseinfo                                                       
  7051. ___________________________________________________________________________
  7052.  
  7053.  
  7054. Function
  7055.                    Gets the Mouse Cursor button release information.
  7056. Syntax
  7057.                    void getbuttonreleaseinfo(unsigned button,
  7058.                      unsigned *buttonstat, unsigned *buttonrelease,
  7059.                        unsigned *xpos, unsigned *ypos);
  7060. Remarks
  7061.                    button specifies for which button information is
  7062.                    required.
  7063.  
  7064.                    buttonstat is the current button status
  7065.                    information.
  7066.  
  7067.                    buttonrelease is the number of times the button
  7068.                    has been released.
  7069.  
  7070.                    xpos, ypos specifies the coordinates where the
  7071.                    button was last released.
  7072.  
  7073.  Programmer's Reference Guide       - 120 -         TEGL Windows Toolkit
  7074.  
  7075.  
  7076.  
  7077.  
  7078.  
  7079.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  7080.  
  7081.  
  7082.                    The information is reset back to zero after the
  7083.                    information has been read.
  7084. See also
  7085.                    mouseposition, getbuttonpressinfo,
  7086.                    clearbuttoninfo
  7087.  
  7088.  
  7089.  
  7090. ___________________________________________________________________________
  7091.  
  7092. getbuttonpressinfo                                                         
  7093. ___________________________________________________________________________
  7094.  
  7095.  
  7096. Function
  7097.                    Gets the Mouse Cursor button press information.
  7098. Syntax
  7099.                    void getbuttonpressinfo(unsigned button,
  7100.                      unsigned buttonstat, unsigned *buttonrelease,
  7101.                        unsigned *xpos, unsigned *ypos);
  7102. Remarks
  7103.                    button specifies for which button information is
  7104.                    required.
  7105.  
  7106.                    buttonstat is the current button status
  7107.                    information.
  7108.  
  7109.                    buttonpress is the number of times the button has
  7110.                    been pressed.
  7111.  
  7112.                    xpos,ypos specifies the coordinates where the
  7113.                    button was last pressed.
  7114.  
  7115.                    The information is reset back to zero after the
  7116.                    information has been read.
  7117. See also
  7118.                    mouseposition, getbuttonreleaseinfo,
  7119.                    clearbuttoninfo
  7120.  
  7121.  
  7122.  
  7123. ___________________________________________________________________________
  7124.  
  7125. clearbuttoninfo                                                            
  7126. ___________________________________________________________________________
  7127.  
  7128.  
  7129. Function
  7130.                    Clears the Mouse button info counters.
  7131.  
  7132.  Programmer's Reference Guide       - 121 -         TEGL Windows Toolkit
  7133.  
  7134.  
  7135.  
  7136.  
  7137.  
  7138.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  7139.  
  7140. Syntax
  7141.                    void clearbuttoninfo(void);
  7142. See also
  7143.                    getbuttonreleaseinfo, getbuttonpressinfo
  7144.  
  7145.  
  7146.  
  7147. ___________________________________________________________________________
  7148.  
  7149. setmouseminmax                                                             
  7150. ___________________________________________________________________________
  7151.  
  7152.  
  7153. Function
  7154.                    Sets the Mouse Cursor minimum and maximum coordinates.
  7155. Syntax
  7156.                    void setmouseminmax(unsigned minx, unsigned miny,
  7157.                      unsigned maxx, unsigned maxy);
  7158. Remarks
  7159.                    MinX, MinY are the minimum relative coordinates
  7160.                    that the mouse may travel. MaxX, MaxY are the
  7161.                    maximum relative coordinates that the mouse may travel.
  7162.  
  7163. See also
  7164.                    SetMousePosition
  7165.  
  7166.  
  7167.  
  7168.  
  7169. ___________________________________________________________________________
  7170.  
  7171. frozenmouse                                                                
  7172. ___________________________________________________________________________
  7173.  
  7174.  
  7175. Function
  7176.                    Prevents the mouse from moving when updating the
  7177.                    screen.
  7178. Syntax
  7179.                    void frozenmouse(void)
  7180. Remarks
  7181.                    Certain EGA registers cannot be read reliably. Rather
  7182.                    then attempting to read and restore the register with
  7183.                    each movement of the mouse, it is more economical to
  7184.                    simply freeze the mouse, while the screen is being
  7185.                    updated.
  7186.  
  7187.                    FrozenMouse retains a counter on the number of times
  7188.                    the mouse is frozen. In order to unfreeze the mouse,
  7189.                    the same number of unfreezemouse calls must be made.
  7190.  
  7191.  Programmer's Reference Guide       - 122 -         TEGL Windows Toolkit
  7192.  
  7193.  
  7194.  
  7195.  
  7196.  
  7197.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  7198.  
  7199. Restrictions
  7200.                    FrozenMouse may be used if the screen update is
  7201.                    temporary (i.e. XorBox), or the second EGA page is being
  7202.                    updated. Care must be taken that the mouse cursor is
  7203.                    not overlapping the updated area, otherwise mouse
  7204.                    droppings may result.
  7205. See also
  7206.                    freezemouse, unfreezemouse
  7207.  
  7208.  
  7209.  
  7210.  
  7211. ___________________________________________________________________________
  7212.  
  7213. freezemouse                                                                
  7214. ___________________________________________________________________________
  7215.  
  7216.  
  7217. Function
  7218.                    Prevents the mouse from moving or being overwritten
  7219.                    when updating the screen.
  7220. Syntax
  7221.                    char freezemouse(unsigned x, unsigned y,
  7222.                      unsigned x1, unsigned y1);
  7223. Result type
  7224.                    Returns the last MouseShow status.
  7225. Remarks
  7226.                    Certain EGA registers cannot be read reliably. Rather
  7227.                    then attempting to read and restore the register with
  7228.                    each movement of the mouse, it is more economical to
  7229.                    simply freeze the mouse, while the screen is being
  7230.                    updated.
  7231.  
  7232.                    freezemouse differs from frozenmouse in that
  7233.                    a check is made on whether the mouse cursor overlaps
  7234.                    the updated area. If the mouse cursor overlaps the
  7235.                    update area, the mouse is hidden until unfreezemouse
  7236.                    displays the mouse.
  7237.  
  7238.                    freezemouse also retains a counter on the number
  7239.                    of times the mouse is frozen. In order to unfreeze the
  7240.                    mouse, the same number of unfreezemouse calls must be
  7241.                    made.
  7242.  
  7243. Restrictions
  7244.                    frozenmouse may be used if the screen update is
  7245.                    temporary (i.e. XorBox), or if the second EGA video page
  7246.                    is being updated.
  7247. See also
  7248.                    frozenmouse, unfreezemouse
  7249.  
  7250.  Programmer's Reference Guide       - 123 -         TEGL Windows Toolkit
  7251.  
  7252.  
  7253.  
  7254.  
  7255.  
  7256.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  7257.  
  7258.  
  7259.  
  7260.  
  7261. ___________________________________________________________________________
  7262.  
  7263. unfreezemouse                                                              
  7264. ___________________________________________________________________________
  7265.  
  7266.  
  7267. Function
  7268.                    Releases the mouse from a frozen or freeze status.
  7269. Syntax
  7270.                    void unfreezemouse(char mshow);
  7271. Remarks
  7272.                    mshow is the mouse show status returned from
  7273.                    freezemouse, or use the global mouseshow flag if
  7274.                    frozenmouse was called.
  7275.  
  7276.                    freezemouse and frozenmouse retain a counter
  7277.                    on the number of times the mouse is frozen. In order to
  7278.                    unfreeze the mouse, the same number of unfreezemouse
  7279.                    calls must be made.
  7280. See also
  7281.                    frozenmouse, freezemouse
  7282.  
  7283.  
  7284.  
  7285. ___________________________________________________________________________
  7286.  
  7287. setmousesensitivity                                                        
  7288. ___________________________________________________________________________
  7289.  
  7290.  
  7291. Function
  7292.                    Sets the mouse-to-cursor movement sensitivity.
  7293. Syntax
  7294.                    void setmousesensitivity(unsigned xsense,
  7295.                      unsigned ysense, unsigned threshold);
  7296. Remarks
  7297.                    xsense defines the horizontal movement
  7298.                    sensitivity.
  7299.  
  7300.                    ysense defines the vertical movement sensitivity.
  7301.  
  7302.                    The sensitivity numbers range from 1 through 100, where
  7303.                    50 specifies the default mickey factor of 1. The
  7304.                    mouse-to-cursor movement is more sensitive at higher
  7305.                    numbers.
  7306.  
  7307.                    The threshold parameter sets the ratio at which
  7308.  
  7309.  Programmer's Reference Guide       - 124 -         TEGL Windows Toolkit
  7310.  
  7311.  
  7312.  
  7313.  
  7314.  
  7315.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  7316.  
  7317.                    the mouse-to-cursor movement is doubled. This range of
  7318.                    this parameter is also 1 through 100. The lower the
  7319.                    threshold, the more sensitive the mouse.
  7320. See also
  7321.                    getmousesensitivity
  7322.  
  7323.  
  7324.  
  7325. ___________________________________________________________________________
  7326.  
  7327. getmousesensitivity                                                        
  7328. ___________________________________________________________________________
  7329.  
  7330.  
  7331. Function
  7332.                    Returns the mouse-to-cursor movement sensitivity
  7333.                    scaling factors previously set by setmousesensitivty.
  7334. Syntax
  7335.                    void getmousesensitivity(unsigned *xsense,
  7336.                      unsigned *ysense, unsigned *threshold);
  7337. Remarks
  7338.                    xsense defines the horizontal movement
  7339.                    sensitivity.
  7340.  
  7341.                    ysense defines the vertical movement sensitivity.
  7342.  
  7343.                    The sensitivity numbers range from 1 through 100, where
  7344.                    50 specifies the default mickey factor of 1. The
  7345.                    mouse-to-cursor movement is more sensitive at higher
  7346.                    numbers.
  7347.  
  7348.                    The threshold parameter is the ratio at which the
  7349.                    mouse-to-cursor movement is doubled. This range of this
  7350.                    parameter is also 1 through 100. The lower the
  7351.                    threshold, the more sensitive the mouse.
  7352. See also
  7353.                    setmousesensitivity
  7354.  
  7355.  
  7356.  
  7357.  
  7358. ___________________________________________________________________________
  7359.  
  7360. setkeyboardmouse                                                           
  7361. ___________________________________________________________________________
  7362.  
  7363.  
  7364. Function
  7365.                    Toggles the keyboard mouse on or off.
  7366. Syntax
  7367.  
  7368.  Programmer's Reference Guide       - 125 -         TEGL Windows Toolkit
  7369.  
  7370.  
  7371.  
  7372.  
  7373.  
  7374.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  7375.  
  7376.                    void setkeyboardmouse(char onoff)
  7377. Remarks
  7378.                    The cursor keys leftarrow downarrow uparrow
  7379.                    rightarrow, on the keyboard, may be used to emulate
  7380.                    the mouse movements. setkeyboardmouse(FALSE)
  7381.                    will turn off the emulation, to allow getch to
  7382.                    retrieve the keycode.
  7383. Restrictions
  7384.                    setkeyboardmouse will have no effect on keyboard
  7385.                    events, (i.e. the cursor keys may be assigned functions
  7386.                    by means of addcapturekey), which will have
  7387.                    priority over the keyboard mouse.
  7388. See also
  7389.                    setkbsteps, getkbsteps
  7390.  
  7391.  
  7392.  
  7393. ___________________________________________________________________________
  7394.  
  7395. setkbsteps                                                                 
  7396. ___________________________________________________________________________
  7397.  
  7398.  
  7399. Function
  7400.                    Sets the amount of pixel movement with each cursor key
  7401.                    press.
  7402. Syntax
  7403.                    void setkbsteps(unsigned xsteps, unsigned ysteps,
  7404.                      unsigned sfxsteps, unsigned sfysteps);
  7405. Remarks
  7406.                    xsteps, ysteps are the positive incremental values
  7407.                    for moving the mouse cursor to the next position.
  7408.                    Initial values are (x=12,y=8).
  7409.  
  7410.                    sfxsteps, sfysteps are the positive incremental
  7411.                    value for moving the mouse cursor to the next position
  7412.                    when using the shiftkey in conjunction with the
  7413.                    leftarrow downarrow uparrow rightarrow keys.
  7414.                    Initial values are (x=2,y=1).
  7415. Restrictions
  7416.                    setkbsteps will have no effect on keyboard events,
  7417.                    (i.e.  the cursor keys may be assigned functions by
  7418.                    means of addcapturekey), which will have priority
  7419.                    over the keyboard mouse.
  7420. See also
  7421.                    setkeyboardmouse, getkbsteps
  7422.  
  7423.  
  7424.  
  7425. ___________________________________________________________________________
  7426.  
  7427.  Programmer's Reference Guide       - 126 -         TEGL Windows Toolkit
  7428.  
  7429.  
  7430.  
  7431.  
  7432.  
  7433.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  7434.  
  7435.  
  7436. getkbsteps                                                                 
  7437. ___________________________________________________________________________
  7438.  
  7439.  
  7440. Function
  7441.                    Returns the pixel movement value set for the keyboard
  7442.                    mouse.
  7443. Syntax
  7444.                    void getkbsteps(unsigned *xsteps, unsigned *ysteps,
  7445.                      unsigned *sfxsteps, unsigned *sfysteps:
  7446.                    word)
  7447. Remarks
  7448.                    xsteps, ysteps are the positive horizontal and
  7449.                    vertical step increments.
  7450.  
  7451.                    sfxsteps, sfysteps are the positive horizontal and
  7452.                    vertical step increments when using the shiftkey in
  7453.                    conjunction with the leftarrow downarrow uparrow
  7454.                    rightarrow keys.
  7455. See also
  7456.                    setkeyboardmouse, setkbsteps
  7457.  
  7458.  
  7459.  
  7460.  
  7461. Timer Functions
  7462.  
  7463. A timer tick has the standard resolution of interrupting any process
  7464. within the system, 18 times a second.  TEGL Windows uses the captured
  7465. timer interrupt to decrement counters and set a flag when the counter is
  7466. zero. TEGLSupervisor monitors the status of the flag and calls the
  7467. attached event when the flag is set.  Thus timed events are processed
  7468. outside the critical timer tick interrupt.
  7469.  
  7470. Timer events may be used as clocks, background tasks, print spoolers etc.
  7471.  
  7472.  
  7473. ___________________________________________________________________________
  7474.  
  7475. swaptimerout                                                               
  7476. ___________________________________________________________________________
  7477.  
  7478.  
  7479. Function
  7480.                    Restores the original timer vectors.
  7481. Syntax
  7482.                    void swaptimerout(void)
  7483. Remarks
  7484.                    use swaptimerout if you need to turn the timer
  7485.  
  7486.  Programmer's Reference Guide       - 127 -         TEGL Windows Toolkit
  7487.  
  7488.  
  7489.  
  7490.  
  7491.  
  7492.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  7493.  
  7494.                    off.
  7495. See also
  7496.                    swaptimerin
  7497.  
  7498.  
  7499.  
  7500. ___________________________________________________________________________
  7501.  
  7502. swaptimerin                                                                
  7503. ___________________________________________________________________________
  7504.  
  7505.  
  7506. Function
  7507.                    Captures the original timer vectors and sets the
  7508.                    interrupt vectors to point at TEGL's timer function.
  7509. Syntax
  7510.                    void swaptimerin(void)
  7511. Remarks
  7512.                    The timer interrupt is originally swapped in.
  7513. Restrictions
  7514.                    SwapTimerIn cannot be called more then once in
  7515.                    succession, otherwise the system will hang.
  7516. See also
  7517.                    SwapTimerIn
  7518.  
  7519.  
  7520.  
  7521. ___________________________________________________________________________
  7522.  
  7523. settimerstart                                                              
  7524. ___________________________________________________________________________
  7525.  
  7526.  
  7527. Function
  7528.                    Sets the timer value of timepiece counter.
  7529. Syntax
  7530.                    void settimerstart(timerecptr *timepiece,
  7531.                      unsigned timeset);
  7532. Remarks
  7533.                    timepiece is of the type timerecptr. if 
  7534.                    timepiece is set to NULL, a timepiece
  7535.                    structure is created and initialized to timeset.
  7536.  
  7537.                    timeset is a word value counter. a value of 18 is
  7538.                    equivalent of 1 second.
  7539. See also
  7540.                    resettimerflag
  7541.  
  7542.  
  7543.  
  7544.  
  7545.  Programmer's Reference Guide       - 128 -         TEGL Windows Toolkit
  7546.  
  7547.  
  7548.  
  7549.  
  7550.  
  7551.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  7552.  
  7553. ___________________________________________________________________________
  7554.  
  7555. resettimerflag                                                             
  7556. ___________________________________________________________________________
  7557.  
  7558.  
  7559. Function
  7560.                    Resets the flag that indicates the completion of a
  7561.                    cycle. A cycle is when the counter reaches zero and is
  7562.                    reset back to its original value.
  7563. Syntax
  7564.                    void resettimerflag(timerecptr timepiece);
  7565. Remarks
  7566.                    timepiece is of the type timerecptr. 
  7567.                    timepiece is created by settimerstart.
  7568. See also
  7569.                    settimerstart
  7570.  
  7571.  
  7572.  
  7573. ___________________________________________________________________________
  7574.  
  7575. droptimercount                                                             
  7576. ___________________________________________________________________________
  7577.  
  7578.  
  7579. Function
  7580.                    Deletes a timepiece record from the timer event
  7581.                    chain.
  7582. Syntax
  7583.                    void droptimercount(timerecptr timepiece);
  7584. Remarks
  7585.                    timepiece is of the type timerecptr. 
  7586.                    timepiece is created by settimerstart.
  7587. See also
  7588.                    settimerstart
  7589.  
  7590.  
  7591.  
  7592. ___________________________________________________________________________
  7593.  
  7594. timerswtich                                                                
  7595. ___________________________________________________________________________
  7596.  
  7597.  
  7598. Function
  7599.                    Toggles the timer handler on or off.
  7600. Syntax
  7601.                    void timerswitch(char onoff)
  7602. Remarks
  7603.  
  7604.  Programmer's Reference Guide       - 129 -         TEGL Windows Toolkit
  7605.  
  7606.  
  7607.  
  7608.  
  7609.  
  7610.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  7611.  
  7612.                    onoff sets the status on whether the timer event
  7613.                    chain is scanned and decremented. A value of 0 stops
  7614.                    the counters from being decremented. A value of 1
  7615.                    resets the counters back to their original values and
  7616.                    causes the counters within the timer event chain to
  7617.                    be decremented 18 times a second.
  7618.  
  7619.                    timerswitch does not remove the timer interrupt
  7620.                    vectors.
  7621. See also
  7622.                    swaptimerout, swaptimerin
  7623.  
  7624.  
  7625.  
  7626. Keyboard Interrupt Events
  7627.  
  7628. There are two levels at which the keyboard interrupt may be used. At the
  7629. higher keyboard event level (monitored by the teglsupervisor),
  7630. complete events, like swapping rotating windows, may be attached to a key
  7631. on the keyboard. However, at the lower level setting the keycall
  7632. parameter in addcapturekey to point at a key handler allows low level
  7633. functions like positioning the mouse cursor to be performed.
  7634.  
  7635. A good example of a key handler is the default mouse click handler.
  7636. The enterkey is used to automatically position the mouse cursor on the
  7637. first defined mouse click area and simulates the holding down of the mouse
  7638. right button, until the key is released.
  7639.  
  7640. The higher Keyboard Event level is set with a call to 
  7641. definelocalkeyclickarea and defineglobalkeyclickarea within 
  7642. teglunit.  The keycall parameter in addcapturekey is set to 
  7643. NULL. Instead of calling an external callproc, the keys are
  7644. stacked in a keyboard buffer that is monitored by the teglsupervisor.
  7645.  
  7646. This TEGL keyboard buffer is separate from the normal keyboard buffer. The
  7647. teglkeypressed and teglreadkey functions are provided to check
  7648. and read captured keys.
  7649.  
  7650. Note: The keyboard handler uses scan codes rather then translated Ascii
  7651. codes.
  7652.  
  7653.  
  7654. Keyboard Scan Codes
  7655.  
  7656. 0x01 esckey                 0x20 key D                    0x40 key F6
  7657. 0x02 key 1key !           0x21 key F                    0x41 key F7
  7658. 0x03 key 2key @           0x22 key G                    0x42 key F8
  7659. 0x04 key 3key #           0x23 key H                    0x43 key F9
  7660. 0x05 key 4key $           0x24 key J                    0x44 f10
  7661. 0x06 key 5key %           0x25 key K                    0x45 numlock
  7662.  
  7663.  Programmer's Reference Guide       - 130 -         TEGL Windows Toolkit
  7664.  
  7665.  
  7666.  
  7667.  
  7668.  
  7669.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  7670.  
  7671. 0x07 key 6key ^           0x26 key L                    0x46 scrlock
  7672. 0x08 key 7key &           0x27 ; :                        0x47 homekey key 7
  7673. 0x09 key 8key *           0x28 ' "                        0x48 uparrow key 8
  7674. 0x0A key 9key (           0x29 ` ~                        0x49 pgupkey key 9
  7675. 0x0B key 0key )           0x2A shiftkey Left            0x4A key -
  7676. 0x0C {key -} _               0x2B {key }                   0x4B {leftarrow} {key 4}
  7677. 0x0D key =key +           0x2C key Z                    0x4C key 5
  7678. 0x0E backspace              0x2D key X                    0x4D rightarrow key 6
  7679. 0x0F forwtabbacktab       0x2E key C                    0x4E key +
  7680. 0x10 key Q                  0x2F key V                    0x4F endkey key 1
  7681. 0x11 key W                  0x30 key B                    0x50 downarrow key 2
  7682. 0x12 key E                  0x31 key N                    0x51 pgdnkey key 3
  7683. 0x13 key R                  0x32 key M                    0x52 inskey key 0
  7684. 0x14 key T                  0x33 key ,key <             0x53 delkey key .
  7685. 0x15 key Y                  0x34 key .key >             0x54 sysreq
  7686. 0x16 key U                  0x35 key /key ?             0x85 bigfrontF11keyback
  7687. 0x17 key I                  0x36 shiftkey Right           0x86 bigfrontF12keyback
  7688. 0x18 key O                  0x37 prtsckeykey *
  7689. 0x19 key P                  0x38 altkey
  7690. 0x1A [ {                     0x39 {spacebar}
  7691. 0x1B ] }                     0x3A {capslock}
  7692. 0x1C enterkey               0x3B key F1
  7693. 0x1D ctrlkey                0x3C key F2
  7694. 0x1E key A                  0x3D key F3
  7695. 0x1F key S                  0x3E key F4
  7696. _                            0x3F key F5
  7697.  
  7698.  
  7699.  
  7700. ___________________________________________________________________________
  7701.  
  7702. addcapturekey                                                              
  7703. ___________________________________________________________________________
  7704.  
  7705.  
  7706. Function
  7707.                    Adds a keyboard scancode to the keyboard handler for
  7708.                    capturing, or for processing immediately when the key
  7709.                    is pressed.
  7710. Syntax
  7711.                    void addcapturekey(unsigned keycode, char repeatkey,
  7712.                      keybrdcallproc keycall);
  7713. Remarks
  7714.                    keycode is the scan code of the keys on the
  7715.                    keyboard. This is different from the ascii code that is
  7716.                    usually translated and passed by DOS. Use the scancode
  7717.                    value listed in the scancode table.
  7718.  
  7719.                    repeatkey is set to 1 if the key is expected
  7720.                    to repeat. 0 if the key must be released before
  7721.  
  7722.  Programmer's Reference Guide       - 131 -         TEGL Windows Toolkit
  7723.  
  7724.  
  7725.  
  7726.  
  7727.  
  7728.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  7729.  
  7730.                    generating another interrupt.
  7731.  
  7732.                    keycall is the key call function when the
  7733.                    keyboard handler captures the key. If keycall is
  7734.                    set to nilkeycallproc the scancode of the capture
  7735.                    key is added to the TEGL keyboard buffer.
  7736.  
  7737.                    addcapturekey can stack the same scan code any
  7738.                    number of times, however, only the most recent entry in
  7739.                    the Scancode chain is used.
  7740. See also
  7741.                    deletecapturekey
  7742.  
  7743.  
  7744.  
  7745. ___________________________________________________________________________
  7746.  
  7747. deletecapturekey                                                           
  7748. ___________________________________________________________________________
  7749.  
  7750.  
  7751. Function
  7752.                    Removes a keyboard scancode from the keyboard scancode
  7753.                    chain.
  7754. Syntax
  7755.                    void deletecapturekey(unsigned keycoded);
  7756. Remarks
  7757.                    keycode is the scan code of the keys on the
  7758.                    keyboard. This is different from the ascii code that is
  7759.                    usually translated and passed by DOS.
  7760.  
  7761.                    If the same scan code is stacked more then once the
  7762.                    most recent entry in the Scancode chain is deleted.
  7763. See also
  7764.                    addcapturekey
  7765.  
  7766.  
  7767.  
  7768. ___________________________________________________________________________
  7769.  
  7770. teglreadkey                                                                
  7771. ___________________________________________________________________________
  7772.  
  7773.  
  7774. Function
  7775.                    Reads a scan code from the TEGL keyboard buffer.
  7776. Syntax
  7777.                    unsigned teglreadkey(void);
  7778. Result type
  7779.                    Returns the first captured scan code in the TEGL
  7780.  
  7781.  Programmer's Reference Guide       - 132 -         TEGL Windows Toolkit
  7782.  
  7783.  
  7784.  
  7785.  
  7786.  
  7787.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  7788.  
  7789.                    keyboard buffer.
  7790. Restrictions
  7791.                    Use teglkeypressed to check if any scan codes are
  7792.                    in the TEGL keyboard buffer.
  7793. See also
  7794.                    teglkeypressed
  7795.  
  7796.  
  7797.  
  7798. ___________________________________________________________________________
  7799.  
  7800. teglkeypressed                                                             
  7801. ___________________________________________________________________________
  7802.  
  7803.  
  7804. Function
  7805.                    Returns True if a scan code is captured; False
  7806.                    otherwise.
  7807. Syntax
  7808.                    char teglkeypressed(void);
  7809. Remarks
  7810.                    The scan code is added to the TEGL keyboard buffer.
  7811. See also
  7812.                    teglreadkey
  7813.  
  7814.  
  7815.  
  7816. ___________________________________________________________________________
  7817.  
  7818. nilkeycallproc                                                             
  7819. ___________________________________________________________________________
  7820.  
  7821.  
  7822. Function
  7823.                    Dummy function to use a place holder.
  7824. Syntax
  7825.                     char nillkeycallproc(void);
  7826. Remarks
  7827.                    This function always returns false.
  7828. See also
  7829.                    addcapturekey.
  7830.  
  7831.  
  7832. Keyboard Miscellaneous
  7833.  
  7834.  
  7835. ___________________________________________________________________________
  7836.  
  7837. setshiftkeys                                                               
  7838. ___________________________________________________________________________
  7839.  
  7840.  Programmer's Reference Guide       - 133 -         TEGL Windows Toolkit
  7841.  
  7842.  
  7843.  
  7844.  
  7845.  
  7846.              Chapter 6 - Mouse, Keyboard and Timer Handlers
  7847.  
  7848.  
  7849.  
  7850. Function
  7851.                    Toggles the Shift flags on/off.
  7852. Syntax
  7853.                    void setshiftkeys(unsigned char shiftflag,
  7854.                      char onoff);
  7855. Remarks
  7856.                    shiftflag may be one of the types as follows:
  7857.  
  7858.  
  7859. enum { sk_rightshift = 0x01 };
  7860. enum { sk_leftshift  = 0x02 };
  7861. enum { sk_ctrlshift  = 0x04 };
  7862. enum { sk_altshift   = 0x08 };
  7863. enum { sk_scrolllock = 0x10 };
  7864. enum { sk_numlock    = 0x20 };
  7865. enum { sk_capslock   = 0x40 };
  7866. enum { sk_inslock    = 0x80 };
  7867.  
  7868.  
  7869.                    onoff sets the above bits to on 1 or off 0.
  7870.  
  7871.  
  7872. Show Button Status
  7873.  
  7874. The tegl.c demonstration program uses the debugunt module to
  7875. display the mouse button status through a menu selection.
  7876.  
  7877.  
  7878. ___________________________________________________________________________
  7879.  
  7880. showbuttonstatus                                                           
  7881. ___________________________________________________________________________
  7882.  
  7883.  
  7884. Function
  7885.                    An Event that displays the mouse button status.
  7886. Syntax
  7887.                    unsigned showbuttonstatus(imagestkptr frame,
  7888.                      ms mouseclickptr);
  7889. Remarks
  7890.                    Information is displayed on the number of times the
  7891.                    mouse buttons have been pressed and released. Shows the
  7892.                    last coordinates where the mouse button was pressed and
  7893.                    the coordinates where the mouse button was released.
  7894.  
  7895.  
  7896.  
  7897.  
  7898.  
  7899.  Programmer's Reference Guide       - 134 -         TEGL Windows Toolkit
  7900.  
  7901.  
  7902.  
  7903.  
  7904.  
  7905.  
  7906.  
  7907.  
  7908.  
  7909.  
  7910.  
  7911.  
  7912.  
  7913.  
  7914.  
  7915.  
  7916.  
  7917.  
  7918.  
  7919.  
  7920.  
  7921.  
  7922.  
  7923.  
  7924.  
  7925.  
  7926.  
  7927.  
  7928.  
  7929.  
  7930.  
  7931.  
  7932.  
  7933.  
  7934.  
  7935.  
  7936.  
  7937.  
  7938.  
  7939.  
  7940.  
  7941.  
  7942.  
  7943.  
  7944.  
  7945.  
  7946.  
  7947.  
  7948.  
  7949.  
  7950.  
  7951.  
  7952.  
  7953.  
  7954.  
  7955.  
  7956.  
  7957.  
  7958.  Programmer's Reference Guide       - 135 -         TEGL Windows Toolkit
  7959.  
  7960.  
  7961.  
  7962.  
  7963.  
  7964.                 Chapter 7 - Assembly Language Graphics
  7965.  
  7966.  
  7967. Assembler Graphics
  7968. ___________________________________________________________________________
  7969.  
  7970. The fastgrph module is the engine that provides the speed that is seen
  7971. in the TEGL Windows Toolkit. Most of the graphics tools are written in
  7972. assembler, with some of the noncritical support routines written in
  7973. C.
  7974.  
  7975. Setting Video Modes
  7976.  
  7977. The following Types and Consts relate to detecting and selecting video
  7978. modes.
  7979.  
  7980. The VidID type is passed as a parameter to VideoID to determine the
  7981. graphics equipment available.
  7982.  
  7983.      struct vidid = 
  7984.          unsigned  video0type;
  7985.          unsigned  display0type;
  7986.          unsigned  video1type;
  7987.          unsigned  display1type;
  7988.       ;
  7989.  
  7990. The graphics adaptor card detected is returned in the Video0Type field.
  7991. Here are a list of the Constants and values and whether they are
  7992. currently supported by the toolkit.
  7993.  
  7994.      TG_MDA    = $01;    monochome display, not supported 
  7995.      TG_CGA    = $02;    Color graphics, supported 
  7996.      TG_EGA    = $03;    Enhanced graphics, supported 
  7997.      TG_MCGA   = $04;    Multicolor graphics array, not supported 
  7998.      TG_VGA    = $05;    Video graphics array, not supported 
  7999.      TG_HGC    = $80;    Hercules graphics, supported 
  8000.      TG_HGCPlus= $81;    Hercules plus, supported 
  8001.      TG_InColor= $82;    Hercules incolor, supported in 2 color mode
  8002.  
  8003.  
  8004.  
  8005. ___________________________________________________________________________
  8006.  
  8007. cga640x200x2                                                               
  8008. ___________________________________________________________________________
  8009.  
  8010.  
  8011. Function
  8012.                    Set the video mode to 640 x 200 in 2 colors.
  8013. Syntax
  8014.                    void cga640x350x2(void);
  8015. Remarks
  8016.  
  8017.  Programmer's Reference Guide       - 136 -         TEGL Windows Toolkit
  8018.  
  8019.  
  8020.  
  8021.  
  8022.  
  8023.                 Chapter 7 - Assembly Language Graphics
  8024.  
  8025.                    This function uses initgraph to switch to
  8026.                    the graphics mode.
  8027. See also
  8028.                    ega640x350x16, herc720x348x2, svga800x600x16,
  8029.                      vga640x480x16
  8030.  
  8031.  
  8032.  
  8033. ___________________________________________________________________________
  8034.  
  8035. ega640x350x16                                                              
  8036. ___________________________________________________________________________
  8037.  
  8038.  
  8039. Function
  8040.                    Sets the video mode to 640 x 350 in 16 colors.
  8041. Syntax
  8042.                    void ega640x350x16(void)
  8043. Remarks
  8044.                    This function uses initgraph to switch to
  8045.                    the graphics mode.
  8046. See also
  8047.                    cga640x350x2, herc720x348x2, svga800x600x16,
  8048.                      vga640x480x16
  8049.  
  8050.  
  8051.  
  8052. ___________________________________________________________________________
  8053.  
  8054. herc720x348x2                                                              
  8055. ___________________________________________________________________________
  8056.  
  8057.  
  8058. Function
  8059.                    Set the video mode to 720 x 350 in 2 colors.
  8060. Syntax
  8061.                    void herc720x348x2(void);
  8062. Remarks
  8063.                    This function uses initgraph to switch to
  8064.                    the graphics mode.
  8065. See also
  8066.                    cga640x350x2, ega640x350x16, svga800x600x16,
  8067.                      vga640x480x16
  8068.  
  8069.  
  8070.  
  8071.  
  8072. ___________________________________________________________________________
  8073.  
  8074. setvideochoices                                                            
  8075.  
  8076.  Programmer's Reference Guide       - 137 -         TEGL Windows Toolkit
  8077.  
  8078.  
  8079.  
  8080.  
  8081.  
  8082.                 Chapter 7 - Assembly Language Graphics
  8083.  
  8084. ___________________________________________________________________________
  8085.  
  8086.  
  8087.  
  8088. Function
  8089.                    Sets the allowable video modes.
  8090. Syntax
  8091.                    setvideochoices(unsigned vmode, char accept);
  8092. Remarks
  8093.                    By default all video modes are acceptable. Certain
  8094.                    programs may not support all video modes.
  8095. See also
  8096.                    videoid, videoautodetect.
  8097. Example
  8098.                    This statement would cause the program to abort if
  8099.                    it were run on a machine which only supported CGA
  8100.                    graphics.
  8101.  
  8102.  
  8103.   setvideochoices(TG_CGA,FALSE);
  8104.  
  8105.  
  8106.  
  8107.  
  8108.  
  8109. ___________________________________________________________________________
  8110.  
  8111. svga800x600x16                                                             
  8112. ___________________________________________________________________________
  8113.  
  8114.  
  8115. Function
  8116.                    Sets the video mode to 800 x 600 in 16 colors.
  8117. Syntax
  8118.                    void svga800x600x16(void);
  8119. Remarks
  8120.                    This  function uses initgrph to switch to the
  8121.                    graphics mode.
  8122. Restrictions
  8123.                    Requires appropiate hardware support.
  8124. See also
  8125.                    cga640x350x2, ega640x350x16, herc720x348x2,
  8126.                      vga640x480x16
  8127.  
  8128.  
  8129. ___________________________________________________________________________
  8130.  
  8131. vga640x480x16                                                              
  8132. ___________________________________________________________________________
  8133.  
  8134.  
  8135.  Programmer's Reference Guide       - 138 -         TEGL Windows Toolkit
  8136.  
  8137.  
  8138.  
  8139.  
  8140.  
  8141.                 Chapter 7 - Assembly Language Graphics
  8142.  
  8143.  
  8144. Function
  8145.                    Sets the video mode to 640 x 480 in 16 colors.
  8146. Syntax
  8147.                    void vga640x480x16(void);
  8148. Remarks
  8149.                    This  function uses initgraph to switch to the
  8150.                    graphics mode.
  8151. Restrictions
  8152.                    Requires a VGA card and monitor.
  8153. See also
  8154.                    cga640x350x2, ega640x350x16, herc720x348x2,
  8155.                      svga800x600x16
  8156.  
  8157.  
  8158.  
  8159. ___________________________________________________________________________
  8160.  
  8161. videoautodetect                                                            
  8162. ___________________________________________________________________________
  8163.  
  8164.  
  8165.  
  8166. Function
  8167.                    Detects the graphics equipment and switches to graphics
  8168.                    mode if available.
  8169. Syntax
  8170.                    videoautodetect;
  8171. Remarks
  8172.                    Selects the highest resolution that is available and
  8173.                    supported.
  8174.  
  8175.                    The global variable InitDriverCode can be
  8176.                    examinded to determine the video mode set.
  8177. See also
  8178.                    videoid
  8179.  
  8180.  
  8181.  
  8182. ___________________________________________________________________________
  8183.  
  8184. videoid                                                                    
  8185. ___________________________________________________________________________
  8186.  
  8187.  
  8188. Function
  8189.                    Detects the graphics equipment available.
  8190. Syntax
  8191.                    videoid(strict v *vidid);
  8192. Remarks
  8193.  
  8194.  Programmer's Reference Guide       - 139 -         TEGL Windows Toolkit
  8195.  
  8196.  
  8197.  
  8198.  
  8199.  
  8200.                 Chapter 7 - Assembly Language Graphics
  8201.  
  8202.                    Graphics equipment is only detected. The current
  8203.                    video mode is not changed.
  8204.  
  8205.  
  8206.  
  8207. Graphic Primitives
  8208.  
  8209. Turbo C offers a rich set of graphics commands, that work with almost
  8210. any video display. However, the drawback to the flexibility of Turbo
  8211. C's BGI Graphics is the speed at which the graphics are displayed.
  8212.  
  8213. To provide a toolset that could operate quickly, the following assembler
  8214. graphic routines were written to replace the ones offered by Turbo C.
  8215.  
  8216. Other then the documented restrictions you may freely mix and match
  8217. Turbo's graphic routines with TEGL's.
  8218.  
  8219. The following constants are defined in teglsys.h and may be assigned
  8220. to RMWBITS to define the type of binary operation between each byte
  8221. in the line and the corresponding bytes on the screen.
  8222.  
  8223.  
  8224.   unsigned      rmwbits;
  8225.  
  8226.   enum { FGNORM = 0x00 };
  8227.   enum { FGAND  = 0x08 };
  8228.   enum { FGOR   = 0x10 };
  8229.   enum { FGXOR  = 0x18 };
  8230.   enum { FGNOT  = 0x80 };
  8231.  
  8232.  
  8233.  
  8234.  
  8235. ___________________________________________________________________________
  8236.  
  8237. fastline                                                                   
  8238. ___________________________________________________________________________
  8239.  
  8240.  
  8241. Function
  8242.                    Draws a line from (x,y) to (x1,y2).
  8243. Syntax
  8244.                    void fastline(unsigned x,unsigned y,unsigned x1,
  8245.                      unsigned y2, unsigned n);
  8246. Remarks
  8247.                    sets the global variable rmwbits to the
  8248.                    appropriate mode for drawing the line.
  8249.  
  8250.                    x,y specifies the line starting coordinates.
  8251.  
  8252.  
  8253.  Programmer's Reference Guide       - 140 -         TEGL Windows Toolkit
  8254.  
  8255.  
  8256.  
  8257.  
  8258.  
  8259.                 Chapter 7 - Assembly Language Graphics
  8260.  
  8261.                    x1,y1 specifies the line ending coordinates.
  8262.  
  8263.                    n specifies the color of the line.
  8264.  
  8265.                    Fastline will only draw a continuous line. 
  8266.                    setlinestyle, setcolor and setwritemode has no
  8267.                    effect on fastline.
  8268.  
  8269.  
  8270.  
  8271. ___________________________________________________________________________
  8272.  
  8273. putpixs                                                                    
  8274. ___________________________________________________________________________
  8275.  
  8276.  
  8277. Function
  8278.                    Plots a pixel.
  8279. Syntax
  8280.                    void putpixs(unsigned x, unsigned y, unsigned n);
  8281. Remarks
  8282.                    Plots a point in the color defined by n at (x,y).
  8283.  
  8284.                    Set the global variable rmwbits to the appropriate
  8285.                    mode for plotting the pixel.
  8286.  
  8287.                    Putpixs replaces the PutPixel routine in Graphics.h.
  8288. See also
  8289.                    getpixs
  8290.  
  8291.  
  8292.  
  8293. ___________________________________________________________________________
  8294.  
  8295. getpixs                                                                    
  8296. ___________________________________________________________________________
  8297.  
  8298.  
  8299. Function
  8300.                    Return the pixel value at x,y.
  8301. Syntax
  8302.                    unsigned getpixs(unsigned x,unsigned y)
  8303. Remarks
  8304.                    Gets the pixel color at (x,y).
  8305.  
  8306.                    getpixs replaces the getpixel routine in
  8307.                    graphics.h.
  8308. See also
  8309.                    putpixs
  8310.  
  8311.  
  8312.  Programmer's Reference Guide       - 141 -         TEGL Windows Toolkit
  8313.  
  8314.  
  8315.  
  8316.  
  8317.  
  8318.                 Chapter 7 - Assembly Language Graphics
  8319.  
  8320.  
  8321.  
  8322.  
  8323. ___________________________________________________________________________
  8324.  
  8325. getbiti                                                                    
  8326. ___________________________________________________________________________
  8327.  
  8328.  
  8329. Function
  8330.                    Copies the specified screen image into a buffer.
  8331. Syntax
  8332.                    void Getbiti(unsigned x, unsigned y, unsigned x1,
  8333.                      unsigned y1, void *buffer)
  8334. Remarks
  8335.                    x,y,x1,y1 defines a rectangular region on the screen.
  8336.  
  8337.                    buffer is a memory area that is large enough to
  8338.                    hold the resulting image.
  8339.  
  8340.                    getbiti replaces the getimage routine in
  8341.                    graphics.h. By using cgetmem with 
  8342.                    bigimagesize, Getbiti will allow saving of images
  8343.                    larger than 64k.
  8344. Restrictons
  8345.                    The saved image structure of getbiti and 
  8346.                    putbiti is different than what getimage and
  8347.                    putimage use.
  8348. See also
  8349.                    putbiti, bigimagesize
  8350.  
  8351.  
  8352.  
  8353. ___________________________________________________________________________
  8354.  
  8355. putbiti                                                                    
  8356. ___________________________________________________________________________
  8357.  
  8358.  
  8359. Function
  8360.                    Copies the buffer to the specified screen area.
  8361. Syntax
  8362.                    void putbiti(unsigned x, unsigned y, void *buffer,
  8363.                      unsigned rmwbits)
  8364. Remarks
  8365.                    x,y defines the upper left corner of the screen
  8366.                    area for placing the saved image.
  8367.  
  8368.                    buffer is the image buffer that contains a copy of
  8369.                    the screen image saved previously by getbiti.
  8370.  
  8371.  Programmer's Reference Guide       - 142 -         TEGL Windows Toolkit
  8372.  
  8373.  
  8374.  
  8375.  
  8376.  
  8377.                 Chapter 7 - Assembly Language Graphics
  8378.  
  8379.  
  8380.                    rmwbits defines the type of binary operation
  8381.                    between the saved image and the corresponding bytes on
  8382.                    the screen.
  8383.  
  8384.                    putbiti replaces the putimage routine in
  8385.                    graphics.h by using cgetmem with 
  8386.                    bigimagesize, putbiti will allow the saving and
  8387.                    restoring of images larger then 64k.
  8388. Restrictons
  8389.                    The saved image structure of getbiti and 
  8390.                    putbiti is different than what GetImage and 
  8391.                    PutImage use.
  8392. See also
  8393.                    getbiti, bigimagesize
  8394.  
  8395.  
  8396.  
  8397. ___________________________________________________________________________
  8398.  
  8399. bigimagesize                                                               
  8400. ___________________________________________________________________________
  8401.  
  8402.  
  8403. Function
  8404.                    Calculates the size of the image buffer.
  8405. Syntax
  8406.                    unsigned long bigimagesize(unsigned x, unsigned y,
  8407.                      unsigned x1, unsigned y1);
  8408. Remarks
  8409.                    x,y,x1,y1 defines the rectangular coordinates that
  8410.                    will be used for getbiti.
  8411.  
  8412.                    bigimagesize replaces the BGI imagesize
  8413.                    routine. By using cgetmem with bigimagesize,
  8414.                    image buffers may be larger then 64k.
  8415. See also
  8416.                    getbiti, putbiti
  8417.  
  8418.  
  8419.  
  8420. ___________________________________________________________________________
  8421.  
  8422. setapage                                                                   
  8423. ___________________________________________________________________________
  8424.  
  8425.  
  8426. Function
  8427.                    Sets the active page for graphics output.
  8428. Syntax
  8429.  
  8430.  Programmer's Reference Guide       - 143 -         TEGL Windows Toolkit
  8431.  
  8432.  
  8433.  
  8434.  
  8435.  
  8436.                 Chapter 7 - Assembly Language Graphics
  8437.  
  8438.                    void setapage(unsigned pagenum);
  8439. Remarks
  8440.                    Makes pagenum the active graphics page. All output,
  8441.                    including those from the BGI's graphics routines,
  8442.                    will be directed to pagenum.
  8443.  
  8444.                    Only two pages are supported with the EGA's
  8445.                    640 x 350 x 16 mode.
  8446. See also
  8447.                    setvpage, flipapage, flipvpage, videopage
  8448.  
  8449.  
  8450.  
  8451. ___________________________________________________________________________
  8452.  
  8453. setvpage                                                                   
  8454. ___________________________________________________________________________
  8455.  
  8456.  
  8457. Function
  8458.                    Sets the visual graphics page number.
  8459. Syntax
  8460.                    void setvpage(unsigned pagenum);
  8461. Remarks
  8462.                    Makes pagenum the visual graphics page. All output,
  8463.                    including that from the BGI routines, will still be
  8464.                    directed to the active pagenum.
  8465.  
  8466.                    Only two pages are supported with the EGA's
  8467.                    640 x 350 x 16 mode.
  8468.  
  8469. See also
  8470.                    setapage, flipapage, flipvpage, videopage
  8471.  
  8472.  
  8473.  
  8474. ___________________________________________________________________________
  8475.  
  8476. flipapage                                                                  
  8477. ___________________________________________________________________________
  8478.  
  8479.  
  8480. Function
  8481.                    Flips the active page to the alternate page.
  8482. Syntax
  8483.                    void FlipAPage(void);
  8484. Remarks
  8485.                    Makes the alternate page the active graphics page. All
  8486.                    output, including that from the BGI routines, will be
  8487.                    directed to the new active page.
  8488.  
  8489.  Programmer's Reference Guide       - 144 -         TEGL Windows Toolkit
  8490.  
  8491.  
  8492.  
  8493.  
  8494.  
  8495.                 Chapter 7 - Assembly Language Graphics
  8496.  
  8497.  
  8498.                    Only two pages are supported with the EGA's 640 x 350 x
  8499.                    16 mode. If the current active page is (1), 
  8500.                    FlipAPage will set the active page to (2). The reverse
  8501.                    is true, if the current active page is (2).
  8502.  
  8503.                    flipapage does not have an equivalent in the BGI.
  8504. See also
  8505.                    setapage, setvpage, flipvpage, videopage
  8506.  
  8507.  
  8508.  
  8509. ___________________________________________________________________________
  8510.  
  8511. flipvpage                                                                  
  8512. ___________________________________________________________________________
  8513.  
  8514.  
  8515. Function
  8516.                    Flips the visual page to the alternate page.
  8517. Syntax
  8518.                    void flipvpage(void)
  8519. Remarks
  8520.                    Makes the alternate page the visual graphics page.
  8521.  
  8522.                    Only two pages are supported with EGA's 640 x 350 x 16.
  8523.                    If the current visual page is (1), flipvpage will
  8524.                    set the visual page to (2). The reverse is true, if the
  8525.                    current visual page is (2).
  8526.  
  8527.                    flipvpage does not have an equivalent in the BGI.
  8528. See also
  8529.                    setapage, setvpage, flipapage, videopage
  8530.  
  8531.  
  8532.  
  8533. ___________________________________________________________________________
  8534.  
  8535. videopage                                                                  
  8536. ___________________________________________________________________________
  8537.  
  8538.  
  8539. Function
  8540.                    Returns the current Visual page.
  8541. Syntax
  8542.                    unsigned VideoPage(void);
  8543. Remarks
  8544.                    Returns the current visual graphics page.
  8545.  
  8546.                    Only two pages are supported with the EGA's
  8547.  
  8548.  Programmer's Reference Guide       - 145 -         TEGL Windows Toolkit
  8549.  
  8550.  
  8551.  
  8552.  
  8553.  
  8554.                 Chapter 7 - Assembly Language Graphics
  8555.  
  8556.                    640 x 350 x 16 mode.
  8557.  
  8558.                    videopage does not have an equivalent in the BGI.
  8559. See also
  8560.                    setapage, setvpage, flipapage, flipvpage
  8561.  
  8562.  
  8563.  
  8564. New Graphic Primitives
  8565.  
  8566. The TEGL Windows Tookit's ability to display fast graphics is, in a way,
  8567. just the tip of the iceberg. The following routines provide functions to
  8568. extract and overlay buffered images before displaying the final results on
  8569. the screen.
  8570.  
  8571. Some of these routines may be used to create a virtual image (an image
  8572. larger then the size of the screen). The only limitation at this time is
  8573. the need for graphic primitives that will draw to a buffered image.
  8574.  
  8575.  
  8576.  
  8577. ___________________________________________________________________________
  8578.  
  8579. extractpixs                                                                
  8580. ___________________________________________________________________________
  8581.  
  8582.  
  8583. Function
  8584.                    Return the pixel value at x,y within an image
  8585.                    buffer.
  8586. Syntax
  8587.                    unsigned extractpixs(unsigned x, unsigned y,
  8588.                      void *buffer)
  8589. Remarks
  8590.                    Gets the pixel color at (x,y) within the saved
  8591.                    image buffer.
  8592.  
  8593.  
  8594.  
  8595. ___________________________________________________________________________
  8596.  
  8597. extractimg                                                                 
  8598. ___________________________________________________________________________
  8599.  
  8600.  
  8601. Function
  8602.                    Extract an image area from a buffer.
  8603.                    x,y,x1,y1 from buff2
  8604.                    to buff1.
  8605. Syntax
  8606.  
  8607.  Programmer's Reference Guide       - 146 -         TEGL Windows Toolkit
  8608.  
  8609.  
  8610.  
  8611.  
  8612.  
  8613.                 Chapter 7 - Assembly Language Graphics
  8614.  
  8615.                    void extractimg(unsigned x, unsigned y, unsigned x1,
  8616.                      unsigned y1, void *buff1, void *buff2);
  8617. Remarks
  8618.                    Extracts the image defined by x, y, x1, y1 from
  8619.                    buff2 and places it in buff1.
  8620. See also
  8621.                    overlayimg, putbiti, getbiti
  8622.  
  8623.  
  8624.  
  8625.  
  8626. ___________________________________________________________________________
  8627.  
  8628. overlayimg                                                                 
  8629. ___________________________________________________________________________
  8630.  
  8631.  
  8632. Function
  8633.                    Overlays buffered image.
  8634. Syntax
  8635.                    void overlayimg(unsigned x, unsigned y,
  8636.                      void *buff1, void *buff2);
  8637. Remarks
  8638.                    Overlays an image in buff1 to buff2 at
  8639.                    x,y offsets.
  8640. See also
  8641.                    ExtractIMG, PutBiti, GetBiti
  8642.  
  8643.  
  8644.  
  8645. ___________________________________________________________________________
  8646.  
  8647. swapbytes                                                                  
  8648. ___________________________________________________________________________
  8649.  
  8650.  
  8651. Function
  8652.                    Swaps two buffers.
  8653. Syntax
  8654.                    void swapbytes(void *buff1, void *buff2,
  8655.                      long bytestoswap);
  8656. Remarks
  8657.                    Swaps the images within buff1 with buff2.
  8658.  
  8659.  
  8660. Graphic Derivatives
  8661.  
  8662. The following are some fast common routines to create XOR boxes that
  8663. can be erased simply by calling the routine again.
  8664.  
  8665.  
  8666.  Programmer's Reference Guide       - 147 -         TEGL Windows Toolkit
  8667.  
  8668.  
  8669.  
  8670.  
  8671.  
  8672.                 Chapter 7 - Assembly Language Graphics
  8673.  
  8674. XORing pixels to the screen has the unique feature that when the same
  8675. pixel is XORed to the same location a second time the pixel is restored to
  8676. it's original look.
  8677.  
  8678. The XOR box routines here allow boxes to flit and dance across the screen
  8679. without (if used correctly) changing any of the underlying display.
  8680.  
  8681.  
  8682.  
  8683. ___________________________________________________________________________
  8684.  
  8685. xorcornerbox                                                               
  8686. ___________________________________________________________________________
  8687.  
  8688.  
  8689. Function
  8690.                    Creates box corners only.
  8691. Syntax
  8692.                    void xorcornerbox(int x, int y, int x1, int y1,
  8693.                      int color);
  8694. Remarks
  8695.                    x,y,x1,y1 are the coordinates of a rectangle.
  8696.  
  8697.                    This routine is used in ziptobox and zipfrombox
  8698.                    to create the shrinking and expanding corner images.
  8699.  
  8700.  
  8701.  
  8702. ___________________________________________________________________________
  8703.  
  8704. xorbox                                                                     
  8705. ___________________________________________________________________________
  8706.  
  8707.  
  8708. Function
  8709.                    Draws a (xor) rectangle.
  8710. Syntax
  8711.                    void xorbox(int x, int y, int x1, int y1, int color);
  8712. Remarks
  8713.                    (x,y) define the upper left corner of a rectangle,
  8714.                    and (x1,y1)  define the lower right corner.
  8715.                    Coordinates must be within the physical screen.
  8716.  
  8717.                    This  routine is used in moveframe to move an (xor)
  8718.                    box image around.
  8719.  
  8720.  
  8721. Icon Graphics
  8722.  
  8723.  
  8724.  
  8725.  Programmer's Reference Guide       - 148 -         TEGL Windows Toolkit
  8726.  
  8727.  
  8728.  
  8729.  
  8730.  
  8731.                 Chapter 7 - Assembly Language Graphics
  8732.  
  8733. ___________________________________________________________________________
  8734.  
  8735. putpict                                                                    
  8736. ___________________________________________________________________________
  8737.  
  8738.  
  8739. Function
  8740.                    Puts an icon to a specified screen area.
  8741. Syntax
  8742.                    void putpict(unsigned x, unsigned y,
  8743.                      unsigned char *buf, unsigned n);
  8744. Remarks
  8745.                    x,y defines the upper left corner of the screen
  8746.                    area for placing the icon image.
  8747.  
  8748.                    buf points to the icon image.
  8749.  
  8750.                    n is the default color for any pixel that is
  8751.                    black within the icon.
  8752. See also
  8753.                    pictsize, icon editor.
  8754.  
  8755.  
  8756. ___________________________________________________________________________
  8757.  
  8758. pictsize                                                                   
  8759. ___________________________________________________________________________
  8760.  
  8761.  
  8762. Function
  8763.                    Gets the width and height in pixels of an icon image.
  8764. Syntax
  8765.                    void pictsize(unsigned *width, unsigned *height,
  8766.                      unsigned char *buffer);
  8767. Remarks
  8768.                    buffer must point to a valid icon image.
  8769. See also
  8770.                    putpict, icon editor.
  8771.  
  8772.  
  8773.  
  8774. ___________________________________________________________________________
  8775.  
  8776. abort_msg                                                                  
  8777. ___________________________________________________________________________
  8778.  
  8779.  
  8780. Function
  8781.                    Closes the graphics system and displays the message
  8782.                    string.
  8783.  
  8784.  Programmer's Reference Guide       - 149 -         TEGL Windows Toolkit
  8785.  
  8786.  
  8787.  
  8788.  
  8789.  
  8790.                 Chapter 7 - Assembly Language Graphics
  8791.  
  8792. Syntax
  8793.                    void abort_msg(char *msg);
  8794. Remarks
  8795.                    This routine is defined in fastgrph because of the
  8796.                    need for closing the graphics system and returning to
  8797.                    text mode before the message can be displayed.
  8798.  
  8799.  
  8800.  
  8801.  
  8802.  
  8803.  
  8804.  
  8805.  
  8806.  
  8807.  
  8808.  
  8809.  
  8810.  
  8811.  
  8812.  
  8813.  
  8814.  
  8815.  
  8816.  
  8817.  
  8818.  
  8819.  
  8820.  
  8821.  
  8822.  
  8823.  
  8824.  
  8825.  
  8826.  
  8827.  
  8828.  
  8829.  
  8830.  
  8831.  
  8832.  
  8833.  
  8834.  
  8835.  
  8836.  
  8837.  
  8838.  
  8839.  
  8840.  
  8841.  
  8842.  
  8843.  Programmer's Reference Guide       - 150 -         TEGL Windows Toolkit
  8844.  
  8845.  
  8846.  
  8847.  
  8848.  
  8849.                      Chapter 8 - Special Effects
  8850.  
  8851.  
  8852. Special Effects
  8853. ___________________________________________________________________________
  8854.  
  8855. The TEGLGrph unit has a nice collection of graphic effects that may
  8856. be used to create 3D characters, shadow boxes, long icon buttons, etc..
  8857.  
  8858. These routines may be combined with the BGI fonts and graphics for even
  8859. more effects.
  8860.  
  8861. We suggest that if you build other graphic effects they should support a
  8862. standard parameter list. Specifically coordinates should be ordered
  8863. x, y, x1, y where x, y are the upper left coordinates and
  8864. x1, y1 are the lower right coordinates of an area on the screen.
  8865.  
  8866.  
  8867. Screen Backdrop
  8868.  
  8869. The backdrop is normally the full physical screen filled with a color and
  8870. pattern to give the effect of a mat. On this mat we place icons and open
  8871. up windows. It's like the velvet mat a Jeweler uses to show off gem stones.
  8872.  
  8873. The backdrop does not require a window frame to draw on.
  8874.  
  8875.  
  8876. ___________________________________________________________________________
  8877.  
  8878. clearteglscreen                                                            
  8879. ___________________________________________________________________________
  8880.  
  8881.  
  8882. Function
  8883.                    Clears the screen to the backdrop pattern.
  8884. Syntax
  8885.                    void clearteglscreen(void);
  8886. Remarks
  8887.                    Fills the complete screen using the bitmask found in
  8888.                    teglbackpattern or teglfillstyle with the
  8889.                    background color of teglbackcolor. Completes the
  8890.                    clearing by placing a border if teglbordershow is
  8891.                    TRUE in the color of teglbordercolor.
  8892.  
  8893.                    The default is a gray matted area with white borders.
  8894. Restrictions
  8895.                    Must be in Graphics mode.
  8896. See also
  8897.                    setteglbordershow, setteglbackcolor,
  8898.                    setteglbordercolor, setteglfillpattern,
  8899.                    setteglfillstyle
  8900. Example
  8901.  
  8902.  Programmer's Reference Guide       - 151 -         TEGL Windows Toolkit
  8903.  
  8904.  
  8905.  
  8906.  
  8907.  
  8908.                      Chapter 8 - Special Effects
  8909.  
  8910.  
  8911.  
  8912.   ega640x350x16();        /* -- sets the graphics mode */
  8913.   setmouseminmax(0,0,getmaxx(),getmaxy());
  8914.  
  8915.   clearteglscreen();
  8916.  
  8917.  
  8918.  
  8919.  
  8920.  
  8921. ___________________________________________________________________________
  8922.  
  8923. setteglbordershow                                                          
  8924. ___________________________________________________________________________
  8925.  
  8926.  
  8927. Function
  8928.                    Sets the switch on whether a border should be drawn or
  8929.                    not drawn after the bar fill.
  8930. Syntax
  8931.                    Macro
  8932.                    void setteglbordershow( char bordershow);
  8933. Remarks
  8934.                    Switches the border on=TRUE or off=FALSE when
  8935.                    teglclearscreen is called.
  8936.  
  8937.                    The default is on TRUE.
  8938. Restrictions
  8939.                    Must be called before calling teglclearscreen.
  8940. See also
  8941.                    teglclearscreen, setteglbackcolor,
  8942.                    setteglbordercolor, setteglfillpattern,
  8943.                    setteglfillstyle
  8944. Example
  8945.  
  8946.  
  8947.   setteglbordershow(FALSE);
  8948.   clearteglscreen();
  8949.  
  8950.  
  8951.  
  8952.  
  8953.  
  8954. ___________________________________________________________________________
  8955.  
  8956. setteglbackcolor                                                           
  8957. ___________________________________________________________________________
  8958.  
  8959.  
  8960.  
  8961.  Programmer's Reference Guide       - 152 -         TEGL Windows Toolkit
  8962.  
  8963.  
  8964.  
  8965.  
  8966.  
  8967.                      Chapter 8 - Special Effects
  8968.  
  8969. Function
  8970.                    Sets the color of the backdrop.
  8971. Syntax
  8972.                    Macro
  8973.                    void setteglbackcolor( unsigned backcolor);
  8974. Remarks
  8975.                    Sets the background color for the backdrop to 
  8976.                    backcolor.
  8977.  
  8978.                    The default is WHITE.
  8979. Restrictions
  8980.                    Must be called before calling teglclearscreen.
  8981. See also
  8982.                    teglclearscreen, setteglbordershow,
  8983.                    setteglbordercolor, setteglfillpattern,
  8984.                    setteglfillstyle
  8985. Example
  8986.  
  8987.  
  8988.   setteglbackcolor(GREEN);
  8989.   clearteglscreen();
  8990.  
  8991.  
  8992.  
  8993.  
  8994.  
  8995. ___________________________________________________________________________
  8996.  
  8997. setteglbordercolor                                                         
  8998. ___________________________________________________________________________
  8999.  
  9000.  
  9001. Function
  9002.                    Sets the border color of the backdrop.
  9003. Syntax
  9004.                    Macro
  9005.                    void setteglbordercolor( unsigned bordercolor);
  9006. Remarks
  9007.                    Sets the border color for the backdrop to 
  9008.                    bordercolor.
  9009.  
  9010.                    The default is WHITE.
  9011. Restrictions
  9012.                    Must be called before calling teglclearscreen.
  9013. See also
  9014.                    teglclearscreen, setteglbordershow,
  9015.                    setteglbackcolor, setteglfillpattern, setteglfillstyle
  9016.  
  9017. Example
  9018.  
  9019.  
  9020.  Programmer's Reference Guide       - 153 -         TEGL Windows Toolkit
  9021.  
  9022.  
  9023.  
  9024.  
  9025.  
  9026.                      Chapter 8 - Special Effects
  9027.  
  9028.  
  9029.   setteglbordercolor(BROWN);
  9030.   clearteglscreen();
  9031.  
  9032.  
  9033.  
  9034.  
  9035.  
  9036. ___________________________________________________________________________
  9037.  
  9038. setteglfillpattern procedure                                       TEGLGRPH
  9039. ___________________________________________________________________________
  9040.  
  9041.  
  9042. Function
  9043.                    Sets the Fill pattern for the backdrop.
  9044. Syntax
  9045.                    Macro
  9046.                    void setteglfillpattern( unsigned char backpattern);
  9047.  
  9048. Remarks
  9049.                    Sets the fill pattern for the backdrop to 
  9050.                    backpattern.
  9051.  
  9052.  
  9053.  
  9054.   unsigned char teglbackpattern[9] =
  9055.    {0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55};
  9056.  
  9057.  
  9058. Restrictions
  9059.                    Must be called befor calling teglclearscreen
  9060.                    to have effect.
  9061. See also
  9062.                    teglclearscreen, setteglbordershow,
  9063.                    setteglbackcolor, setteglbordercolor, setteglfillstyle
  9064.  
  9065.  
  9066.  
  9067.  
  9068.  
  9069. ___________________________________________________________________________
  9070.  
  9071. setteglfillstyle                                                           
  9072. ___________________________________________________________________________
  9073.  
  9074.  
  9075. Function
  9076.                    Sets the Fill style for the backdrop.
  9077. Syntax
  9078.  
  9079.  Programmer's Reference Guide       - 154 -         TEGL Windows Toolkit
  9080.  
  9081.  
  9082.  
  9083.  
  9084.  
  9085.                      Chapter 8 - Special Effects
  9086.  
  9087.                    Macro
  9088.                    void setteglfillstyle( unsigned pattern);
  9089. Remarks
  9090.                    Sets the fill style to pattern.
  9091.  
  9092.                    Use one of the predefined fill styles from Graphics.h.
  9093.  
  9094.                    Setting the fill style cancels the user defined
  9095.                    pattern.
  9096. Restrictions
  9097.                    Must be called before calling teglclearscreen.
  9098. See also
  9099.                    teglclearscreen, setteglbordershow,
  9100.                    setteglbackcolor, setteglbordercolor,
  9101.                    setteglfillpattern
  9102. Example
  9103.  
  9104.  
  9105.   setteglfillpattern(SOLID_FILL);
  9106.   clearteglscreen();
  9107.  
  9108.  
  9109.  
  9110.  
  9111.  
  9112. Creating Shadow Boxes
  9113.  
  9114. A shadow box is a simple rectangular that has a shadow edge to give a
  9115. 3-dimensional effect.  A shadow box is the quickest method to clear a
  9116. window after pushimage.
  9117.  
  9118.  
  9119. ___________________________________________________________________________
  9120.  
  9121. shadowbox                                                                  
  9122. ___________________________________________________________________________
  9123.  
  9124.  
  9125. Function
  9126.                    Creates a 3-D type box at the rectangular area defined
  9127.                    by x, y, x1, y1.
  9128. Syntax
  9129.                    void shadowbox(unsigned x, unsigned y,
  9130.                      unsigned x1, unsigned y1);
  9131. Remarks
  9132.                    x, y, x1, y1 defines the rectangular area for the
  9133.                    shadowbox.
  9134.  
  9135.                    The default bar SOLID fill color is 
  9136.                    WHITE with BLACK borders and BLACK shadow.
  9137.  
  9138.  Programmer's Reference Guide       - 155 -         TEGL Windows Toolkit
  9139.  
  9140.  
  9141.  
  9142.  
  9143.  
  9144.                      Chapter 8 - Special Effects
  9145.  
  9146. See also
  9147.                    setshadowcolor, setshadowbordercolor,
  9148.                    setshadowfillpattern, setshadowfillstyle
  9149. Example
  9150.  
  9151.  
  9152.   pushimage(100,100,200,200);
  9153.   shadowbox(100,100,200,200);
  9154.  
  9155.  
  9156.  
  9157.  
  9158.  
  9159. ___________________________________________________________________________
  9160.  
  9161. shadowboxtext                                                              
  9162. ___________________________________________________________________________
  9163.  
  9164.  
  9165. Function
  9166.                    Outputs a text string within a shadowbox.
  9167. Syntax
  9168.                    void shadowboxtext(unsigned x, unsigned y, unsigned txtlen,
  9169.                      char *textstr);
  9170. See also
  9171.                    shadowbox
  9172. Example
  9173.  
  9174.  
  9175.   shadowboxtext(100,100,200,"Tegl systems corporation");
  9176.  
  9177.  
  9178.  
  9179.  
  9180.  
  9181. ___________________________________________________________________________
  9182.  
  9183. setshadowcolor                                                             
  9184. ___________________________________________________________________________
  9185.  
  9186.  
  9187. Function
  9188.                    Sets the bar fill color.
  9189. Syntax
  9190.                    Macro
  9191.                    void setshadowcolor(unsigned bcolor);
  9192. Remarks
  9193.                    bcolor defines the shadowbox color.
  9194.  
  9195.                    The default bar fill color is WHITE.
  9196.  
  9197.  Programmer's Reference Guide       - 156 -         TEGL Windows Toolkit
  9198.  
  9199.  
  9200.  
  9201.  
  9202.  
  9203.                      Chapter 8 - Special Effects
  9204.  
  9205. See also
  9206.                    shadowbox, setshadowbordercolor,
  9207.                    setshadowfillpattern, setshadowfillstyle
  9208. Example
  9209.  
  9210.  
  9211.  
  9212.   pushimage(100,100,200,200);
  9213.   setshadowcolor(RED);
  9214.   shadowbox(100,100,200,200);
  9215.  
  9216.  
  9217.  
  9218.  
  9219.  
  9220. ___________________________________________________________________________
  9221.  
  9222. setshadowbordercolor                                                       
  9223. ___________________________________________________________________________
  9224.  
  9225.  
  9226. Function
  9227.                    Sets the shadowbox border color.
  9228. Syntax
  9229.                    Macro
  9230.                    void setshadowbordercolor(unsigned bcolor);
  9231. Remarks
  9232.                    bcolor defines the shadowbox border color.
  9233.  
  9234.                    The default border color is BLACK.
  9235. See also
  9236.                    shadowbox, setshadowcolor, setshadowfillpattern,
  9237.                    setshadowfillstyle
  9238. Example
  9239.  
  9240.  
  9241.  
  9242.   pushimage(100,100,200,200);
  9243.   setshadowbordercolor(LIGHTGRAY);
  9244.   shadowbox(100,100,200,200);
  9245.  
  9246.  
  9247.  
  9248.  
  9249.  
  9250. ___________________________________________________________________________
  9251.  
  9252. setshadowfillpattern                                                       
  9253. ___________________________________________________________________________
  9254.  
  9255.  
  9256.  Programmer's Reference Guide       - 157 -         TEGL Windows Toolkit
  9257.  
  9258.  
  9259.  
  9260.  
  9261.  
  9262.                      Chapter 8 - Special Effects
  9263.  
  9264.  
  9265. Function
  9266.                    Sets the bar fill pattern for ShadowBox.
  9267. Syntax
  9268.                    Macro
  9269.                    void setshadowfillpattern( unsigned char backpattern);
  9270. Remarks
  9271.                    The default fill pattern is SOLIDFILL which is
  9272.                    defined in graphics.h.
  9273. See also
  9274.                    shadowbox, setshadowcolor,
  9275.                    setshadowbordercolor, setshadowfillstyle
  9276. Example
  9277.  
  9278.  
  9279.  
  9280.   unsigned char myshadowpattern[9] =
  9281.    {0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55};
  9282.  
  9283.   pushimage(100,100,200,200);
  9284.   setshadowfillpattern(myshadowpattern);
  9285.   shadowbox(100,100,200,200);
  9286.  
  9287.  
  9288.  
  9289.  
  9290.  
  9291. ___________________________________________________________________________
  9292.  
  9293. setshadowfillstyle                                                         
  9294. ___________________________________________________________________________
  9295.  
  9296.  
  9297. Function
  9298.                    Sets the bar fill style for shadowbox.
  9299. Syntax
  9300.                    Macro
  9301.                    void setshadowfillstyle( unsigned pattern);
  9302. Remarks
  9303.                    pattern is of one of the predefined type in
  9304.                    graphics.h.
  9305.  
  9306.                    The default fill style is SOLID_FILL.
  9307. See also
  9308.                    shadowbox, setshadowcolor, setshadowbordercolor,
  9309.                    setshadowfillpattern
  9310. Example
  9311.  
  9312.  
  9313.   pushimage(100,100,200,200);
  9314.  
  9315.  Programmer's Reference Guide       - 158 -         TEGL Windows Toolkit
  9316.  
  9317.  
  9318.  
  9319.  
  9320.  
  9321.                      Chapter 8 - Special Effects
  9322.  
  9323.   setshadowfillstyle(LINE_FILL);
  9324.   shadowbox(100,100,200,200);
  9325.  
  9326.  
  9327.  
  9328.  
  9329.  
  9330. Creating Shadow Text
  9331.  
  9332. Shadow text enhances the normal BGI fonts by writing the text string
  9333. several times with a slight shift of the x,y coordinates on each write.
  9334.  
  9335. This simple method provides a 3-D quality to any BGI or TEGL font.
  9336.  
  9337.  
  9338.  
  9339. ___________________________________________________________________________
  9340.  
  9341. shadowtext                                                                 
  9342. ___________________________________________________________________________
  9343.  
  9344.  
  9345. Function
  9346.                    Displays a shadowed textstr at (x,y).
  9347. Syntax
  9348.                    void shadowtext(unsigned x,unsigned y,
  9349.                      unsigned color, char *textstr);
  9350. Remarks
  9351.                    x,y specifies the coordinates for displaying the
  9352.                    textstr.
  9353.  
  9354.                    color specifies the color of the textstr.
  9355.  
  9356.                    shadowtext is affected by settextstyle,
  9357.                    settextjustify and setusercharsize in 
  9358.                    graphics.h.
  9359. See also
  9360.                    setshadowtexttype, setshadowtextshadow,
  9361.                    setshadowtexthighlight, shadowtexthighlightoff
  9362. Example
  9363.  
  9364.  
  9365.   shadowtext(100,100,LIGHTCYAN,"TEGL systems corporation");
  9366.  
  9367.  
  9368.  
  9369.  
  9370.  
  9371.  
  9372. ___________________________________________________________________________
  9373.  
  9374.  Programmer's Reference Guide       - 159 -         TEGL Windows Toolkit
  9375.  
  9376.  
  9377.  
  9378.  
  9379.  
  9380.                      Chapter 8 - Special Effects
  9381.  
  9382.  
  9383. setshadowtexttype                                                          
  9384. ___________________________________________________________________________
  9385.  
  9386.  
  9387. Function
  9388.                    Sets the shadow text font type.
  9389. Syntax
  9390.                    Macro
  9391.                    void setshadowtexttype(fontptr texttype);
  9392. Remarks
  9393.                    texttype is a pointer to one of the TEGL fonts. If
  9394.                    texttype is set to NULL, shadowtext uses 
  9395.                    outtextxy in the graphics.h.
  9396. See also
  9397.                    shadowtext, setshadowtextshadow,
  9398.                    setshadowtexthighlight, shadowtexthighlightoff
  9399. Example
  9400.  
  9401.  
  9402.   setshadowtexttype(script);
  9403.   shadowtext(100,100,LIGHTCYAN,"TEGL systems corporation");
  9404.  
  9405.  
  9406.  
  9407.  
  9408.  
  9409. ___________________________________________________________________________
  9410.  
  9411. setshadowtextshadow                                                        
  9412. ___________________________________________________________________________
  9413.  
  9414.  
  9415. Function
  9416.                    Sets the shadow color for ShadowText.
  9417. Syntax
  9418.                    Macro
  9419.                    void setshadowtextshadow(insigned color);
  9420. Remarks
  9421.                    color is the shadow color when displaying the
  9422.                    shadowed text.
  9423.  
  9424.                    The default shadow color is BLACK.
  9425. See also
  9426.                    shadowtext, setshadowtexttype,
  9427.                    setshadowtexthighlight, shadowtexthighlightoff
  9428. Example
  9429.  
  9430.  
  9431.   setshadowtextshadow(LIGHTGRAY);
  9432.  
  9433.  Programmer's Reference Guide       - 160 -         TEGL Windows Toolkit
  9434.  
  9435.  
  9436.  
  9437.  
  9438.  
  9439.                      Chapter 8 - Special Effects
  9440.  
  9441.   shadowtext(100,100,LIGHTCYAN,"TEGL systems corporation");
  9442.  
  9443.  
  9444.  
  9445.  
  9446.  
  9447. ___________________________________________________________________________
  9448.  
  9449. setshadowtexthighlight                                                     
  9450. ___________________________________________________________________________
  9451.  
  9452.  
  9453. Function
  9454.                    Sets the highlighted color for shadowtext.
  9455. Syntax
  9456.                    Macro
  9457.                    void setshadowtexthighlight(insigned color);
  9458. Remarks
  9459.                    color is the highlighted color when displaying the
  9460.                    shadowed text. Sormally, shadowtext toggles the
  9461.                    high bit of color to achieve the different
  9462.                    shadings.
  9463. See also
  9464.                    shadowtext, setshadowtexttype,
  9465.                    setshadowtextshadow, shadowtexthighlightoff
  9466. Example
  9467.  
  9468.  
  9469.   setshadowtexthighlight(BLUE);
  9470.   shadowtext(100,100,LIGHTCYAN,"TEGL systems corporation");
  9471.  
  9472.  
  9473.  
  9474.  
  9475.  
  9476. ___________________________________________________________________________
  9477.  
  9478. shadowtexthighlightoff                                                     
  9479. ___________________________________________________________________________
  9480.  
  9481.  
  9482. Function
  9483.                    Resets the highlight color set by 
  9484.                    setshadowtexthighlight.
  9485. Syntax
  9486.                    void shadowtexthighlightoff(void);
  9487. Remarks
  9488.                    Switches off the highlight color set by 
  9489.                    setshadowtexthighlight.
  9490. See also
  9491.  
  9492.  Programmer's Reference Guide       - 161 -         TEGL Windows Toolkit
  9493.  
  9494.  
  9495.  
  9496.  
  9497.  
  9498.                      Chapter 8 - Special Effects
  9499.  
  9500.                    shadowtext, setshadowtexttype,
  9501.                    setshadowtextshadow, setshadowtexthighlight
  9502. Example
  9503.  
  9504.  
  9505.   setshadowtexthighlight(BLUE
  9506.   shadowtext(100,100,LIGHTCYAN "TEGL systems corporation");
  9507.   shadowtexthighlightoff()
  9508.   shadowtext(100,120,LIGHTCYAN,"TEGL systems corporation");
  9509.  
  9510.  
  9511.  
  9512.  
  9513. Other text effects
  9514.  
  9515.  
  9516. ___________________________________________________________________________
  9517.  
  9518. extendtextxy                                                               
  9519. ___________________________________________________________________________
  9520.  
  9521.  
  9522. Function
  9523.                    Makes embossed text.
  9524. Syntax
  9525.                    void extendtextxy(unsigned x, unsigned y, char *sg); 
  9526. Restrictions
  9527.                    Does not work with BGI fonts.
  9528. Example
  9529.  
  9530.  
  9531.   imagestkptr  ifs;
  9532.  
  9533.   quickframe(ifs,100,100,300,150);
  9534.   outtegltextxy(105,105,"normal text");
  9535.   extendtextxy(105,125,"embossed text");
  9536.  
  9537.  
  9538.  
  9539.  
  9540.  
  9541. ___________________________________________________________________________
  9542.  
  9543. shifttextxy                                                                
  9544. ___________________________________________________________________________
  9545.  
  9546.  
  9547. Function
  9548.                    Writes text with a leading white edge.
  9549. Syntax
  9550.  
  9551.  Programmer's Reference Guide       - 162 -         TEGL Windows Toolkit
  9552.  
  9553.  
  9554.  
  9555.  
  9556.  
  9557.                      Chapter 8 - Special Effects
  9558.  
  9559.                    void shifttextxy(unsigned x, unsigned y, char *s);
  9560. Restrictions
  9561.                    Does not work with BGI fonts.
  9562. Remarks
  9563.                    x and y are absolute screen coordinates, s
  9564.                    is the string to display.
  9565. Example
  9566.  
  9567.  
  9568.   imagestkptr ifs;
  9569.  
  9570.   setshadowcolor(LIGHTGRAY);
  9571.   quickframe(ifs,100,100,300,150);
  9572.   outtegltextxy(105,105,"normal text");
  9573.   shifttextxy(105,125,"shifted text");
  9574.  
  9575.  
  9576.  
  9577.  
  9578. Buttons
  9579.  
  9580.  
  9581. ___________________________________________________________________________
  9582.  
  9583. definebuttonclick                                                          
  9584. ___________________________________________________________________________
  9585.  
  9586.  
  9587.  
  9588. Function
  9589.                    Displays an icon, sets mouse click area and attaches it
  9590.                    to an Event.
  9591. Syntax
  9592.                    definebuttonclick(imagestkptr ifs, unsigned x,
  9593.                      unsigned y, char *button, callproc p); 
  9594. Remarks
  9595.                    Ifs is the frame the icon is placed on. Button can
  9596.                    be any icon image. p is the event to pass control to
  9597.                    when the icon is clicked on.
  9598.  
  9599.                    p can be set to collapsetoiconshow or
  9600.                    collapsetomsclick if the button is for closing a frame.
  9601. Example
  9602.  
  9603.  
  9604.   definebuttonclick(ifs,150,200,&imageok,collapsetoiconshow);
  9605.  
  9606.  
  9607.  
  9608.  
  9609.  
  9610.  Programmer's Reference Guide       - 163 -         TEGL Windows Toolkit
  9611.  
  9612.  
  9613.  
  9614.  
  9615.  
  9616.                      Chapter 8 - Special Effects
  9617.  
  9618.  
  9619. ___________________________________________________________________________
  9620.  
  9621. definelongbuttonclick                                                      
  9622. ___________________________________________________________________________
  9623.  
  9624.  
  9625.  
  9626. Function
  9627.                    Displays a long button with text, sets mouse click area,
  9628.                    and attaches it to an event.
  9629. Syntax
  9630.                    void definelongbuttonclick(imagestkptr ifs unsigned x,
  9631.                      unsigned y, unsigned ln, char *msg, callproc p); 
  9632. Remarks
  9633.                    ifs is the frame the button is placed on. x,y are the
  9634.                    coordinates to place the button at. ln is the length of
  9635.                    the message in pixels (depends on currently selected
  9636.                    font) and msg is the text to place inside the button.
  9637.                    p is the event to activate when the button is clicked on.
  9638. Example
  9639.  
  9640.  
  9641.   definelongbuttonclick(ifs,100,150,35,"Quit",collapsetomsclick);
  9642.  
  9643.  
  9644.  
  9645.  
  9646.  
  9647. ___________________________________________________________________________
  9648.  
  9649. defineuserbuttonclick                                                      
  9650. ___________________________________________________________________________
  9651.  
  9652.  
  9653.  
  9654. Function
  9655.                    Displays a button with text, sets mouse click area, and
  9656.                    attaches it to an event.
  9657. Syntax
  9658.                    void defineuserbuttonclick( imagestkptr ifs, unsigned x,
  9659.                      unsigned y, char *msg, callproc p); 
  9660. Remarks
  9661.                    ifs is the frame the button is placed on. x,y are
  9662.                    the coordinates to place the button at and msg is
  9663.                    the text to place inside the button. p is the
  9664.                    event to activate when the button is clicked on.
  9665. Restrictons
  9666.                    msg cannot be more than about 4 characters. This is
  9667.                    dependant on the currently selected font.
  9668.  
  9669.  Programmer's Reference Guide       - 164 -         TEGL Windows Toolkit
  9670.  
  9671.  
  9672.  
  9673.  
  9674.  
  9675.                      Chapter 8 - Special Effects
  9676.  
  9677. Example
  9678.  
  9679.  
  9680.   defineuserbuttonclick(ifs,100,150,"Quit",collapsetomsclick);
  9681.  
  9682.  
  9683.  
  9684.  
  9685.  
  9686.  
  9687. ___________________________________________________________________________
  9688.  
  9689. putuserbuttonclick                                                         
  9690. ___________________________________________________________________________
  9691.  
  9692.  
  9693.  
  9694. Function
  9695.                    Draws a button at the coordinates with a message.
  9696. Syntax
  9697.                    void putuserbuttonclick(imagestkptr ifs, unsigned x,
  9698.                      unsigned y, char *msg); 
  9699. Restrictions
  9700.                    msg cannot be more than about 4 charcters, depends
  9701.                    upon the currently selected font.
  9702. Remarks
  9703.                    This routine just displays a button, no mouse click
  9704.                    area is defined.
  9705.  
  9706.  
  9707. Explosions
  9708.  
  9709.  
  9710. ___________________________________________________________________________
  9711.  
  9712. collapsetoiconshow                                                         
  9713. ___________________________________________________________________________
  9714.  
  9715.  
  9716. Function
  9717.                    Collapse a frame and restore the icon it came from.
  9718. Syntax
  9719.                    unsigned collapsetoiconshow(imagestkptr ifs,
  9720.                      msclickptr ms);
  9721. Restrictions
  9722.                    Should only be attached to a frame created after a call
  9723.                    to explodefromiconhide.
  9724. Remarks
  9725.                    After opening a frame from a explodefromiconhide, this
  9726.                    Event can be attached to a button within the frame. When
  9727.  
  9728.  Programmer's Reference Guide       - 165 -         TEGL Windows Toolkit
  9729.  
  9730.  
  9731.  
  9732.  
  9733.  
  9734.                      Chapter 8 - Special Effects
  9735.  
  9736.                    this button is clicked on, the frame will collapse and zip
  9737.                    to the original icon location and restore the icon.
  9738. See also
  9739.                    explodefromiconhide, definebuttonclick.
  9740.  
  9741.  
  9742.  
  9743. ___________________________________________________________________________
  9744.  
  9745. collapsetomsclick                                                          
  9746. ___________________________________________________________________________
  9747.  
  9748.  
  9749. Function
  9750.                    Collapse a frame and zip back to the original mouse click
  9751.                    position.
  9752. Syntax
  9753.                    unsigned collapsetomsclick(imagestkptr ifs,
  9754.                      msclickptr ms);
  9755. Restrictions
  9756.                    Should only be attacted to a frame created after a call
  9757.                    to explodefrommsclick.
  9758. Remarks
  9759.                    After opening a frame from a explodefrommsclick, this
  9760.                    Event can be attached to a button within the frame. When
  9761.                    this button is clicked on, the frame will collapse and zip
  9762.                    to the original defined mouse click area.
  9763. See also
  9764.                    explodefrommsclick, definebuttonclick.
  9765.  
  9766.  
  9767.  
  9768. ___________________________________________________________________________
  9769.  
  9770. explodefromiconhide                                                        
  9771. ___________________________________________________________________________
  9772.  
  9773.  
  9774. Function
  9775.                    Hides the icon, zips and opens a new frame.
  9776. Syntax
  9777.                    void explodefromiconhide(imagestkptr : ifs,
  9778.                      mouseclickptr ms, unsigned x, unsigned y,
  9779.                        unsiigned x1, unsigned y1);
  9780. Restrictions
  9781.                    The icon exploded from must be in a frame of its own
  9782.                    for this to look right.
  9783. Remarks
  9784.                    ifs and ms are the parameters passed to an event.
  9785.                    x,y,x1,y1 are the coordinates where a new frame is
  9786.  
  9787.  Programmer's Reference Guide       - 166 -         TEGL Windows Toolkit
  9788.  
  9789.  
  9790.  
  9791.  
  9792.  
  9793.                      Chapter 8 - Special Effects
  9794.  
  9795.                    to be opened. After a call to this procedure a new frame is
  9796.                    created. Save the global variable stackptr if you wish to
  9797.                    manipulate the new frame.
  9798. See also
  9799.                    collapsetoiconshow, definebuttonclick.
  9800.  
  9801.  
  9802.  
  9803. ___________________________________________________________________________
  9804.  
  9805. explodefrommsclick                                                         
  9806. ___________________________________________________________________________
  9807.  
  9808.  
  9809. Function
  9810.                    Zips from a mouse click location to a new frame
  9811.                    position.
  9812. Syntax
  9813.                    void explodefrommsclick(imagestkptr ifs,
  9814.                      mouseclickpos ms, unsigned x, unsigned y,
  9815.                        unsigned x1, unsigned y1); 
  9816. Remarks
  9817.                    ifs and ms are the parameters passed to an event.
  9818.                    x,y,x1,y1 are the coordinates where a new frame is
  9819.                    to be opened. After a call to this procedure a new frame is
  9820.                    created. Save the global variable stackptr if you wish to
  9821.                    manipulate the new frame.
  9822. See also
  9823.                    collapsetomsclick, defineuserbuttonclick.
  9824.  
  9825.  
  9826. Moving and Transforming XOR Boxes
  9827.  
  9828.  
  9829. ___________________________________________________________________________
  9830.  
  9831. movebox                                                                    
  9832. ___________________________________________________________________________
  9833.  
  9834.  
  9835. Function
  9836.                    Moves a (XOR) wire frame from x, y to ax, ay.
  9837.  
  9838. Syntax
  9839.                    void movebox(int ax, int ay, int x, int y,
  9840.                      int x1, int y1);
  9841. Remarks
  9842.                    x, y, x1, y1 specify the coordinates of the
  9843.                    starting (XOR) wire frame.
  9844.  
  9845.  
  9846.  Programmer's Reference Guide       - 167 -         TEGL Windows Toolkit
  9847.  
  9848.  
  9849.  
  9850.  
  9851.  
  9852.                      Chapter 8 - Special Effects
  9853.  
  9854.                    ax, ay are the upper left coordinates of the
  9855.                    ending position of the (XOR) wire frame.
  9856.  
  9857.                    The box movement is divided into 6 steps which is added
  9858.                    or subtracted from the originating position until it
  9859.                    reaches the destination.
  9860.  
  9861.                    The global variable zipduration may be changed to
  9862.                    set the delay between each movement step.
  9863. See also
  9864.                    xorbox, xorcornerbox, ziptobox, zipfrombox
  9865. Example
  9866.                    A wire frame box 50(w) x 50(h) is moveed from 100,100
  9867.                    to 500,280.
  9868.  
  9869.  
  9870.  
  9871.   movebox(500,280,100,100,150,150);
  9872.  
  9873.  
  9874.  
  9875.  
  9876.  
  9877. ___________________________________________________________________________
  9878.  
  9879. ziptobox                                                                   
  9880. ___________________________________________________________________________
  9881.  
  9882.  
  9883. Function
  9884.                    Creates a moving and expanding (XOR) wire frame from
  9885.                    ax, ay, ax1, ay1 to x, y, x1, y1.
  9886. Syntax
  9887.                    void ziptobox(int ax, int ay, int ax1, int ay1,
  9888.                      int x, int y, int x1, int y1);
  9889. Remarks
  9890.                    ax, ay, ax1, ay1 specifies the rectangular
  9891.                    coordinates of the starting (XOR) wire frame.
  9892.  
  9893.                    x, y, x1, y1 specifies the rectangular coordinates
  9894.                    of the ending (XOR) wire frame.
  9895.  
  9896.                    The box is moved from (ax,ay) to (x,y) using 
  9897.                    MoveBox before the box is transformed (expanded).
  9898.                    The transformation is divided into 6 steps which is
  9899.                    added or subtracted from (ax,ay,ax1,ay1) until the size
  9900.                    equals (x,y,x1,y1).
  9901.  
  9902.                    The global variable zipduration may be changed to
  9903.                    set the delay between each movement step.
  9904.  
  9905.  Programmer's Reference Guide       - 168 -         TEGL Windows Toolkit
  9906.  
  9907.  
  9908.  
  9909.  
  9910.  
  9911.                      Chapter 8 - Special Effects
  9912.  
  9913. See also
  9914.                    xorbox, xorcornerbox, movebox, zipfrombox
  9915. Example
  9916.                    A wire frame box 50(w) x 50(h) at (100,100) will be
  9917.                    visually moved and expanded to a box 100(w) x 100(h) at
  9918.                    400,200.
  9919.  
  9920.  
  9921.   ziptobox(100,100,150,150,400,100,500,200);
  9922.  
  9923.  
  9924.  
  9925.  
  9926.  
  9927. ___________________________________________________________________________
  9928.  
  9929. zipfrombox                                                                 
  9930. ___________________________________________________________________________
  9931.  
  9932.  
  9933. Function
  9934.                    Creates a shrinking and moving (XOR) wire frame from
  9935.                    x, y, x1, y1 to ax, ay, ax1, ay1.
  9936. Syntax
  9937.                    void zipfrombox(int ax, int ay, int ax1, int ay1,
  9938.                      int x, int y, int x1, int y1);
  9939. Remarks
  9940.                    x, y, x1, y1 specifies the rectangular coordinates
  9941.                    of the starting (XOR) wire frame.
  9942.  
  9943.                    ax, ay, ax1, ay1 specifies the rectangular
  9944.                    coordinates of the ending (XOR) wire frame.
  9945.  
  9946.                    The box is transformed by dividing the transformation
  9947.                    steps into 6 steps which is added or subtracted from (x,
  9948.                    y,x1,y1) until the size equals (ax,ay,ax1,ay1). The box
  9949.                    is then moved from (x,y) to (ax,ay) using MoveBox.
  9950.  
  9951.                    The global variable zipduration may be changed to
  9952.                    set the delay between each movement step.
  9953. See also
  9954.                    xorbox, xorcornerbox, movebox, zipfrombox
  9955. Example
  9956.                    A wire frame box 100(w) x 100(h) at (x=400,y=200) will
  9957.                    be visually shrunk and moved to a box 50(w) x 50(h) at
  9958.                    (x=100,y=100).
  9959.  
  9960.  
  9961.   zipfrombox(100,100,150,150,400,100,500,200);
  9962.  
  9963.  
  9964.  Programmer's Reference Guide       - 169 -         TEGL Windows Toolkit
  9965.  
  9966.  
  9967.  
  9968.  
  9969.  
  9970.                      Chapter 8 - Special Effects
  9971.  
  9972.  
  9973.  
  9974.  
  9975.  
  9976. Icon Button
  9977.  
  9978.  
  9979. ___________________________________________________________________________
  9980.  
  9981. drawlongbutton                                                             
  9982. ___________________________________________________________________________
  9983.  
  9984.  
  9985. Function
  9986.                    Creates an icon button of size ln at (x,y).
  9987. Syntax
  9988.                    void drawlongbutton( unsigned x, unsigned y,
  9989.                      unsigned ln );
  9990. Remarks
  9991.                    x,y specifies the coordinates for the icon button.
  9992.                    ln specifies the length of the icon button in
  9993.                    pixels.
  9994. Example
  9995.  
  9996.  
  9997.   unsigned  x, y;
  9998.  
  9999.   x = 100; y = 100;
  10000.   drawlongbutton(x,y,200);
  10001.   setteglfont(font14);
  10002.   setcolor(WHITE);
  10003.   outtegltextxy(x+15,y+1,"TEGL Systems Corporation");
  10004.  
  10005.  
  10006.  
  10007.  
  10008.  
  10009.  
  10010.  
  10011.  
  10012.  
  10013.  
  10014.  
  10015.  
  10016.  
  10017.  
  10018.  
  10019.  
  10020.  
  10021.  
  10022.  
  10023.  Programmer's Reference Guide       - 170 -         TEGL Windows Toolkit
  10024.  
  10025.  
  10026.  
  10027.  
  10028.  
  10029.                       Chapter 9 - Writing Events
  10030.  
  10031.  
  10032. Writing Events
  10033. ___________________________________________________________________________
  10034.  
  10035. All Event-handlers must use the following header definition.
  10036.  
  10037.  
  10038. unsigned myevents(imagestkptr frame, msclickptr mouseclickpos);
  10039.  
  10040.  
  10041.  
  10042. This is the declaration of a callproc. It is a far call, you must
  10043. compile in the large memory model.
  10044.  
  10045.  
  10046. Mouse Awareness
  10047.  
  10048.  
  10049. ___________________________________________________________________________
  10050.  
  10051. findframe                                                                  
  10052. ___________________________________________________________________________
  10053.  
  10054.  
  10055. Function
  10056.                    Searches through the Frame stack for the first frame
  10057.                    that overlaps the coordinates passed as a parameter.
  10058. Syntax
  10059.                    imagestkptr findframe(unsigned mxpos,
  10060.                      unsigned mypos);
  10061. Result type
  10062.                    Pointer.
  10063. Remarks
  10064.                    Returns a imagestkptr if the parameters overlap
  10065.                    one of the frames, otherwise returns NULL for no match.
  10066.  
  10067.                    findframe is used by the teglsupervisor, but is
  10068.                    provided as an external function to allow for
  10069.                    specialize routines that may be used to replace the
  10070.                    teglsupervisor.
  10071. Restrictions
  10072.                    findframe starts the scan from the top of the stack,
  10073.                    thereby returning the first frame found that overlaps
  10074.                    the parameters.
  10075. See also
  10076.                    checkmouseclickpos
  10077. Example
  10078.                    The following example creates 250 random boxes and
  10079.                    monitors the position of the mouse pointer to see if it
  10080.                    overlaps one of the boxes. The timer tick routine is
  10081.  
  10082.  Programmer's Reference Guide       - 171 -         TEGL Windows Toolkit
  10083.  
  10084.  
  10085.  
  10086.  
  10087.  
  10088.                       Chapter 9 - Writing Events
  10089.  
  10090.                    used to blink the overlapped box, once every second.
  10091.  
  10092.  
  10093.  
  10094.  
  10095.  
  10096.  
  10097.  
  10098.  
  10099. ___________________________________________________________________________
  10100.  
  10101. checkmouseclickpos                                                         
  10102. ___________________________________________________________________________
  10103.  
  10104.  
  10105. Function
  10106.                    Compares all Mouse click defines within a frame, for a
  10107.                    match with the current mouse coordinates.
  10108. Syntax
  10109.                    msclickptr checkmouseclickpos(imagestkptr frame,
  10110.                      unsigned mxpos, unsigned mypos);
  10111. Result type
  10112.                    Pointer.
  10113. Remarks
  10114.                    Returns a msclickptr type if mouse coordinates
  10115.                    matches one of the mouse click defines, otherwise
  10116.                    returns NULL for no match.
  10117.  
  10118.                    checkmouseclickpos is normally an internal function,
  10119.                    used by the teglsupervisor. The mouse click position
  10120.                    information is normally provided as the second
  10121.                    parameter of an event, whenever an event is called.
  10122.  
  10123.                    However, checkmouseclickpos may be used to rewrite the
  10124.                    teglsupervisor or used to determine if the mouse click
  10125.                    position has changed.
  10126. Restrictions
  10127.                    findframe should be used first, to check if another
  10128.                    frame is overlapping the current frame, before using
  10129.                    checkmouseclickpos.
  10130. See also
  10131.                    definemouseclickptr, resetmouseclicks,
  10132.                    findmouseclickptr, resetmsclicksense,
  10133.                    resetmsclickcallproc, resetmsclickactive
  10134. Example
  10135.                    The following example defines an array of 100 Mouse
  10136.                    click areas which uses checkmouseclickpos to establish
  10137.                    the mouse location within the frame.
  10138.  
  10139.  
  10140.  
  10141.  Programmer's Reference Guide       - 172 -         TEGL Windows Toolkit
  10142.  
  10143.  
  10144.  
  10145.  
  10146.  
  10147.                       Chapter 9 - Writing Events
  10148.  
  10149.  
  10150.  
  10151.  
  10152.  
  10153.  
  10154.  
  10155.  
  10156. ___________________________________________________________________________
  10157.  
  10158. checkformouseselect                                                        
  10159. ___________________________________________________________________________
  10160.  
  10161.  
  10162. Function
  10163.                    Checks if one of the mouse click areas within a frame
  10164.                    has been selected.
  10165. Syntax
  10166.                    msclickptr checkformouseselect(imagestkptr frame)
  10167. Result type
  10168.                    Returns the Mouse Click Pointer if mouse button was
  10169.                    released while the mouse cursor overlaps a button icon.
  10170.  
  10171. Remarks
  10172.                    This function may be used when only the Frame is known
  10173.                    and the program is waiting for the user to click on one
  10174.                    of a series of unknown icons.
  10175.  
  10176.                    checkformouseselect may be used within an event to wait
  10177.                    on a multiple button type icon replies from the user.
  10178.  
  10179.                    If pressbuttonflag is true, then visualbuttonpress is
  10180.                    called to simulate the pressing of a button icon.
  10181. Restrictions
  10182.                    If pressbuttonflag is true, the restrictions for
  10183.                    visualbuttonpress should be followed. If the icon does
  10184.                    not have a black fringe, set pressbuttonflag to false.
  10185. See also
  10186.                    pressbutton, visualbuttonpress
  10187. Example
  10188.                    The following example creates (8) button type icons,
  10189.                    which calls up a window that displays two choices, 
  10190.                    Cancel or OK. The event waits until one of the
  10191.                    choices are made before returning to teglsupervisor.
  10192.  
  10193.  
  10194.  
  10195.  
  10196.  
  10197.  
  10198.  
  10199.  
  10200.  Programmer's Reference Guide       - 173 -         TEGL Windows Toolkit
  10201.  
  10202.  
  10203.  
  10204.  
  10205.  
  10206.                       Chapter 9 - Writing Events
  10207.  
  10208.  
  10209. Special Effects
  10210.  
  10211.  
  10212. ___________________________________________________________________________
  10213.  
  10214. pressbutton                                                                
  10215. ___________________________________________________________________________
  10216.  
  10217.  
  10218. Function
  10219.                    Simulates the pressing of a button type icon. The
  10220.                    actual routine simply shifts the icon down and to the
  10221.                    right by two pixels.
  10222. Syntax
  10223.                    void pressbutton(imagestkptr fs, msclickptr mouseopt);
  10224. Remarks
  10225.                    This function is used mainly by visualbuttonpress to
  10226.                    simulate the action of a electronic button switch.
  10227.  
  10228.                    pressbutton may be used to create the illusion of a
  10229.                    button left in the down position.
  10230. Restrictions
  10231.                    You are required to redraw the button if you need the
  10232.                    button in the up position.
  10233.  
  10234.                    This routine only works with icons that have a black
  10235.                    fringe of two pixels wide on the right and bottom of
  10236.                    the icon. The defined mouse click area should not
  10237.                    include this shadow area ie. x1 and y1 is less two
  10238.                    pixels.
  10239. See also
  10240.                    visualbuttonpress, checkformouseselect
  10241. Example
  10242.                    The following example creates (8) button type icons and
  10243.                    toggles the buttons on/off whenever the icon is clicked
  10244.                    upon.
  10245.  
  10246.  
  10247.  
  10248.  
  10249.  
  10250.  
  10251.  
  10252.  
  10253.  
  10254. ___________________________________________________________________________
  10255.  
  10256. visualbuttonpress                                                          
  10257. ___________________________________________________________________________
  10258.  
  10259.  Programmer's Reference Guide       - 174 -         TEGL Windows Toolkit
  10260.  
  10261.  
  10262.  
  10263.  
  10264.  
  10265.                       Chapter 9 - Writing Events
  10266.  
  10267.  
  10268.  
  10269. Function
  10270.                    Performs the pressing and releasing of a button type
  10271.                    icon, controlled by the holding down of the left mouse
  10272.                    button. Returns when either the user releases the left
  10273.                    mouse button or the mouse cursor wanders off the
  10274.                    defined mouse click area.
  10275. Syntax
  10276.                    char visualbuttonpress(imagestkptr frame,
  10277.                       msclickptr mouseopt);
  10278. Result type
  10279.                    Returns true if mouse button was released while the
  10280.                    mouse cursor overlaps with the button icon.
  10281. Remarks
  10282.                    This function may be used whenever the Frame and the
  10283.                    Mouse Click Option is known. If the program is waiting
  10284.                    for the user to click on one of a series of unknown
  10285.                    icons, use checkformouseselect to do an automatic frame
  10286.                    and Mouse click Option search.
  10287.  
  10288.                    visualbuttonpress is excellent as an entry routine for
  10289.                    an event, since the frame and mouse click position are
  10290.                    known.
  10291. Restrictions
  10292.                    This routine only works with icons that has a black
  10293.                    fringe of two pixels wide on the right and bottom of
  10294.                    the icon. The defined mouse click area should not
  10295.                    include this shadow area ie. x1 and y1 is less two
  10296.                    pixels.
  10297. See also
  10298.                    pressbutton, checkformouseselect
  10299. Example
  10300.                    The following example creates (8) button type icons,
  10301.                    allowing the mouse cursor to glide over (while the
  10302.                    buttons simulates the on/off motions). A series of
  10303.                    beeps are sounded when the mouse button is released
  10304.                    with the mouse cursor is on a button.
  10305.  
  10306.  
  10307.  
  10308.  
  10309.  
  10310.  
  10311.  
  10312.  
  10313.  
  10314.  
  10315.  
  10316.  
  10317.  
  10318.  Programmer's Reference Guide       - 175 -         TEGL Windows Toolkit
  10319.  
  10320.  
  10321.  
  10322.  
  10323.  
  10324.                       Chapter 9 - Writing Events
  10325.  
  10326.  
  10327.  
  10328.  
  10329.  
  10330.  
  10331.  
  10332.  
  10333.  
  10334.  
  10335.  
  10336.  
  10337.  
  10338.  
  10339.  
  10340.  
  10341.  
  10342.  
  10343.  
  10344.  
  10345.  
  10346.  
  10347.  
  10348.  
  10349.  
  10350.  
  10351.  
  10352.  
  10353.  
  10354.  
  10355.  
  10356.  
  10357.  
  10358.  
  10359.  
  10360.  
  10361.  
  10362.  
  10363.  
  10364.  
  10365.  
  10366.  
  10367.  
  10368.  
  10369.  
  10370.  
  10371.  
  10372.  
  10373.  
  10374.  
  10375.  
  10376.  
  10377.  Programmer's Reference Guide       - 176 -         TEGL Windows Toolkit
  10378.  
  10379.  
  10380.  
  10381.  
  10382.  
  10383.                         Chapter 10 - Animation
  10384.  
  10385.  
  10386. Animation
  10387. ___________________________________________________________________________
  10388.  
  10389. The Animation unit provides the tools to animate a series of icons.
  10390. Combined with the Icon Editor, an event can come to life.
  10391.  
  10392. Animation in its simplest form is the sequential display of frames.  A
  10393. frame in the sense of the animator is a single still image that is
  10394. displayed.  By linking a series of frames, animation is achieved by
  10395. displaying each frame in sequence.
  10396.  
  10397. Animation is as simple as declaring a object, initializing the object,
  10398. then animating the object.
  10399.  
  10400.  
  10401. As an example:
  10402.  
  10403.  
  10404.  
  10405.   animateobject  bounceicon;
  10406.  
  10407.   resetframe(&bounceicon,1);
  10408.   animateinit();
  10409.   origin(&bounceicon,604,wy);
  10410.   animate(&bounceicon,8);
  10411.  
  10412.  
  10413.  
  10414.  
  10415. Animation Overview
  10416.  
  10417. Animating a series of icons is relatively easy with the functions in the 
  10418. animate module. The hardest part is creating the series of icons and
  10419. coordinating the movement differences between them.
  10420.  
  10421. The first step is to declare an variable of animateobject. Here
  10422. bounceicon is declared as the type animateobject.
  10423.  
  10424.  
  10425.   animateobject bounceicon;
  10426.  
  10427.  
  10428.  
  10429. The variable bounceicon must be initialized before we can
  10430. begin adding frame sequences.  To initialize bounceicon,
  10431. use the function init.
  10432.  
  10433.  
  10434.   init(&bounceicon);
  10435.  
  10436.  Programmer's Reference Guide       - 177 -         TEGL Windows Toolkit
  10437.  
  10438.  
  10439.  
  10440.  
  10441.  
  10442.                         Chapter 10 - Animation
  10443.  
  10444.  
  10445.  
  10446.  
  10447. The next step is to add an icon frame to it.  The function addframe
  10448. adds an icon frame sequence to a animateobject.  The parameters are
  10449. from left to right; the icon constant, defined in TEGLIcon Unit; (-15,
  10450. 0) the horizontal and vertical travel offset, respectively, on completion
  10451. of this frame sequence; (14,37) the height and width of the icon; (10) the
  10452. duration in (milliseconds) before progressing to the next sequence; (0,0)
  10453. the sound in hertz, and duration; (black) the color replacement for any
  10454. black pixels in the icon. In this case, black replaces black.
  10455.  
  10456.  
  10457.  
  10458.   addframe(&bounceicon,imageBLANKBUT,-15,0,14,37,10,0,0,black);
  10459.  
  10460.  
  10461.  
  10462. An object can have a number of different frame sequences.  In our example,
  10463. we need two sequences; a sequence for animating from the right side of the
  10464. screen to the left side and a sequence for animating from the left to the
  10465. right.  Thus we will label the above frame as Sequence 1. The labels
  10466. are arbitrary numbers ranging from 0 to 65535. However, you must use this
  10467. label to switch to the appropriate sequence when the frames are animated.
  10468.  
  10469.  
  10470.  
  10471.   sequence(&bounceicon,1);
  10472.  
  10473.  
  10474.  
  10475. Use the function resetsequence to reset the counters within the
  10476. object before creating the second sequence.  We then assign the second
  10477. sequence the arbitrary number of 2.  The only difference between this
  10478. addframe and the last addframe is the horizontal travel offset.
  10479. Instead of -15, the value is positive, adding to the x coordinate.
  10480.  
  10481.  
  10482.  
  10483.   resetsequence(&bounceicon);
  10484.   addframe(&bounceicon,imageBLANKBUT,15,0,14,37,10,0,0,black);
  10485.   sequence(&bounceicon,2);
  10486.  
  10487.  
  10488.  
  10489.  
  10490. The function animateinit, replicates the first screen to the second
  10491. screen.
  10492.  
  10493.  
  10494.  
  10495.  Programmer's Reference Guide       - 178 -         TEGL Windows Toolkit
  10496.  
  10497.  
  10498.  
  10499.  
  10500.  
  10501.                         Chapter 10 - Animation
  10502.  
  10503.  
  10504.   animateinit(&bounceicon);
  10505.  
  10506.  
  10507.  
  10508. Set the animation origin. In our test program, we will set the icon to the
  10509. middle of the screen.
  10510.  
  10511.  
  10512.  
  10513.   origin(&bounceicon,getmaxx div 2,getmaxy div 2);
  10514.  
  10515.  
  10516.  
  10517. To animate the frames, we use the function animate. animate
  10518. displays the frames until the requested frame count is reached. Since
  10519. we have only one frame to animate within each sequence, the animator
  10520. will loop using the same frame until it satisfies the requested frame
  10521. count.
  10522.  
  10523. However, since we are working with coordinates, we do not know how many
  10524. frames it would take to move the icon across the screen. The function 
  10525. destination will perform a test run on the sequence until one of the
  10526. coordinates is satisfied and passes back a count of the frames needed to
  10527. reach the destination. Thus, we can use the method Destination with
  10528. the method animate to finally animate the icon.
  10529.  
  10530.  
  10531.  
  10532.   sequence( &bounceicon, 1);
  10533.   Animate( &bounceicon, Destination( &bounceicon, 36, 0));
  10534.  
  10535.  
  10536.  
  10537. Animating from left to right.
  10538.  
  10539.  
  10540.   sequence(&bounceicon, 2);
  10541.   animate(&bounceicon, destination(&bounceicon, 560, 0));
  10542.  
  10543.  
  10544.  
  10545. Try experimenting with the example program.  You can use the same icon to
  10546. add a few more frames to each sequence.  Vary the travel offsets to see
  10547. the effect. However, be careful that the resulting travel distance should
  10548. reach the destination, otherwise the animator will loop forever trying to
  10549. reach a false destination. As well, the function destination provides
  10550. only an approximate count of frames to reach the destination. The actual
  10551. destination coordinate will depend on the travel offset values on each
  10552. frame added or subtracted from the origin.
  10553.  
  10554.  Programmer's Reference Guide       - 179 -         TEGL Windows Toolkit
  10555.  
  10556.  
  10557.  
  10558.  
  10559.  
  10560.                         Chapter 10 - Animation
  10561.  
  10562.  
  10563.  
  10564. Animation Functions
  10565.  
  10566.  
  10567. ___________________________________________________________________________
  10568.  
  10569. origin procedure                                                           
  10570. ___________________________________________________________________________
  10571.  
  10572.  
  10573. Function
  10574.                    Sets the animated object's starting origin.
  10575. Syntax
  10576.                    void origin(animateobject *ao, unsigned ox,
  10577.                      unsigned oy); 
  10578. Remarks
  10579.                    Sets where the first frame will be displayed.
  10580. See also
  10581.                    getorigin, destination
  10582. Example
  10583.  
  10584.  
  10585.  
  10586.   apple   animateobject;
  10587.  
  10588.   origin(&apple, 100, 100);
  10589.  
  10590.  
  10591.  
  10592.  
  10593.  
  10594.  
  10595. ___________________________________________________________________________
  10596.  
  10597. getorigin                                                                  
  10598. ___________________________________________________________________________
  10599.  
  10600.  
  10601. Function
  10602.                    Gets the animated object's current coordinates.
  10603. Syntax
  10604.                    void getorigin(animateobject *ao, int *lastox,
  10605.                      int *lastoy);
  10606. Remarks
  10607.                    Returns the current coordinate from where animate
  10608.                    will proceed from.
  10609.  
  10610.                    The origins of an animated object will change
  10611.                    depending on the travel offset defined in each
  10612.  
  10613.  Programmer's Reference Guide       - 180 -         TEGL Windows Toolkit
  10614.  
  10615.  
  10616.  
  10617.  
  10618.  
  10619.                         Chapter 10 - Animation
  10620.  
  10621.                    animation frame.
  10622. See also
  10623.                    origin, destination
  10624. Example
  10625.  
  10626.  
  10627.  
  10628.   animateobject  apple;
  10629.   unsigned       lastx, lasty;
  10630.  
  10631.   animate(&apple, 5);
  10632.   getorigin(&apple, &lastx, &lasty);
  10633.  
  10634.  
  10635.  
  10636.  
  10637.  
  10638.  
  10639. ___________________________________________________________________________
  10640.  
  10641. destination                                                                
  10642. ___________________________________________________________________________
  10643.  
  10644.  
  10645. Function
  10646.                    Returns a count on the number of frames that is needed
  10647.                    for animating before the sequence gets the destination
  10648.                    coordinates dx,dy.
  10649. Syntax
  10650.                    unsigned destination(animateobject *ao, int dx, int dy);
  10651. Result type
  10652.                    Unsigned. Frame count.
  10653. Remarks
  10654.                    destination will return a count if either x
  10655.                    or y coordinates of the origin is less then or
  10656.                    greater then the destination dx,dy coordinates.
  10657.  
  10658.                    destination is only an approximation of the number
  10659.                    of frames required to complete the travel distance. The
  10660.                    actual movement is dependent on each frame and its
  10661.                    travel offsets.
  10662. See also
  10663.                    origin, getorigin
  10664. Example
  10665.  
  10666.  
  10667.   animateobject  apple;
  10668.  
  10669.   animate(&apple, destination( &apple, 300, 300));
  10670.  
  10671.  
  10672.  Programmer's Reference Guide       - 181 -         TEGL Windows Toolkit
  10673.  
  10674.  
  10675.  
  10676.  
  10677.  
  10678.                         Chapter 10 - Animation
  10679.  
  10680.  
  10681.  
  10682.  
  10683.  
  10684.  
  10685. ___________________________________________________________________________
  10686.  
  10687. resetframe                                                                 
  10688. ___________________________________________________________________________
  10689.  
  10690.  
  10691. Function
  10692.                    Resets a sequence to begin at any frame number.
  10693. Syntax
  10694.                    void resetframe(animateobject *ao, unsigned startframe);
  10695. Remarks
  10696.                    if startframe is greater then the number of frames
  10697.                    in the sequence, the sequence is set at the last frame.
  10698.  
  10699.                    startframe of 0 will reset the sequence back to
  10700.                    the beginning.
  10701. See also
  10702.                    sequence
  10703. Example
  10704.  
  10705.  
  10706.  
  10707.  
  10708.   animateobject  apple;
  10709.  
  10710.   resetframe(&apple, 0);
  10711.   animate(&apple, 5);
  10712.  
  10713.  
  10714.  
  10715.  
  10716.  
  10717. ___________________________________________________________________________
  10718.  
  10719. sequence                                                                   
  10720. ___________________________________________________________________________
  10721.  
  10722.  
  10723. Function
  10724.                    Sets the sequence pointer.
  10725. Syntax
  10726.                    sequence(animateobject *ao, unsigned seqnum);
  10727. Remarks
  10728.                    seqnum is any number associated with a sequence of
  10729.                    frames. If the sequence number does not exist, the
  10730.  
  10731.  Programmer's Reference Guide       - 182 -         TEGL Windows Toolkit
  10732.  
  10733.  
  10734.  
  10735.  
  10736.  
  10737.                         Chapter 10 - Animation
  10738.  
  10739.                    method will assume that a new sequence will be created.
  10740.  
  10741.                    Creating a new sequence, simply records the seqnum
  10742.                    and the start frame. So creating a sequence can occur
  10743.                    anytime after adding the first frame. You can continue
  10744.                    to add frames after sequence. Use 
  10745.                    resetsequence to clear and start a new sequence.
  10746. See also
  10747.                    resetsequence, resetframe
  10748. Example
  10749.  
  10750.  
  10751.   animateobject apple;
  10752.  
  10753.   init(&apple);
  10754.   addframe(&apple,imageAPPLE,mx,my,ht,wd,dl,hz,hzdl,color);
  10755.   addframe(&apple,imageAPPLE,mx,my,ht,wd,dl,hz,hzdl,color);
  10756.   sequence(&apple, 88);
  10757.  
  10758.   ResetSequence(&apple);
  10759.   addframe(&apple,imageAPPLE,mx,my,ht,wd,dl,hz,hzdl,color);
  10760.   addframe(&apple,imageAPPLE,mx,my,ht,wd,dl,hz,hzdl,color);
  10761.   sequence(&apple,99);
  10762.  
  10763.   sequence(&apple, 88);
  10764.   animate(&apple, 5);
  10765.  
  10766.  
  10767.  
  10768.  
  10769.  
  10770. ___________________________________________________________________________
  10771.  
  10772. resetsequence                                                              
  10773. ___________________________________________________________________________
  10774.  
  10775.  
  10776. Function
  10777.                    Sets the internal data pointers firstframe and 
  10778.                    currentframe to nil.
  10779. Syntax
  10780.                    void resetsequence(animateobject *ao);
  10781. Remarks
  10782.                    resetsequence will reset the internal data
  10783.                    pointers to nil. This will allow a new sequence to
  10784.                    begin.
  10785. Restrictions
  10786.                    Use the method sequence to save the data pointers,
  10787.                    otherwise all created frames will be lost.
  10788. See also
  10789.  
  10790.  Programmer's Reference Guide       - 183 -         TEGL Windows Toolkit
  10791.  
  10792.  
  10793.  
  10794.  
  10795.  
  10796.                         Chapter 10 - Animation
  10797.  
  10798.                    resetsequence, resetframe
  10799. Example
  10800.  
  10801.  
  10802.   animateobject apple;
  10803.  
  10804.   init(&apple);
  10805.   addframe(&apple,imageAPPLE,mx,my,ht,wd,dl,hz,hzdl,color);
  10806.   addframe(&apple,imageAPPLE,mx,my,ht,wd,dl,hz,hzdl,color);
  10807.   sequence(&apple,88);
  10808.  
  10809.   resetsequence(&apple);
  10810.   addframe(&apple,imageAPPLE,mx,my,ht,wd,dl,hz,hzdl,color);
  10811.   addframe(&apple,imageAPPLE,mx,my,ht,wd,dl,hz,hzdl,color);
  10812.   sequence(&apple,99);
  10813.  
  10814.   sequence(&apple,88);
  10815.   animate(&apple,5);
  10816.  
  10817.  
  10818.  
  10819.  
  10820.  
  10821. ___________________________________________________________________________
  10822.  
  10823. addframe                                                                   
  10824. ___________________________________________________________________________
  10825.  
  10826.  
  10827. Function
  10828.                    Add a animation frame.
  10829. Syntax
  10830.                    void addframe(animateobject *ao, char *pp,
  10831.                      int mx, int my, insigned ht, unsigned wd, unsigned dy,
  10832.                        unsigned hz, unsigned hzdy, unsigned co);
  10833. Remarks
  10834.                    addframe is the icon definition pointer.
  10835.  
  10836.                    mx,my is the travel offsets that are added to the
  10837.                    origin after the icon is displayed.
  10838.  
  10839.                    ht,wd is the height and width of the icon. These
  10840.                    parameters are used to save the background image before
  10841.                    drawing the icon.
  10842.  
  10843.                    dy is the delay in milliseconds after displaying
  10844.                    the image.
  10845.  
  10846.                    hz,hzdy is the frequency of the frame sound, and
  10847.                    hzdy is the duration. If the duration of hzdy is
  10848.  
  10849.  Programmer's Reference Guide       - 184 -         TEGL Windows Toolkit
  10850.  
  10851.  
  10852.  
  10853.  
  10854.  
  10855.                         Chapter 10 - Animation
  10856.  
  10857.                    longer then the image dy, then dy is used for
  10858.                    the frame and the sound is left on after the frame
  10859.                    ends.
  10860.  
  10861.                    co is the replacement color for the BLACK
  10862.                    color pixels defined in the icon.
  10863. Restrictions
  10864.                    Use the function sequence to save the data pointers,
  10865.                    otherwise all created frames will be lost.
  10866. See also
  10867.                    resetsequence, resetframe
  10868. Example
  10869.  
  10870.  
  10871.   animateobject  apple;
  10872.  
  10873.   init(&apple);
  10874.   addframe(&apple,imageBLANKBUT,-15,0,14,37,10,0,0,black);
  10875.   animate(&apple, 5);
  10876.  
  10877.  
  10878.  
  10879.  
  10880.  
  10881. ___________________________________________________________________________
  10882.  
  10883. currentframenumber                                                         
  10884. ___________________________________________________________________________
  10885.  
  10886.  
  10887. Function
  10888.                    Returns the current frame number.
  10889. Syntax
  10890.                    unsigned currentframenumber(animateobject *ao);
  10891. Result type
  10892.                    Unsigned.
  10893. See also
  10894.                    resetframe
  10895.  
  10896.  
  10897.  
  10898. ___________________________________________________________________________
  10899.  
  10900. animateinit                                                                
  10901. ___________________________________________________________________________
  10902.  
  10903.  
  10904. Function
  10905.                    Replicates the first active screen page to the second
  10906.                    in preparation for animating.
  10907.  
  10908.  Programmer's Reference Guide       - 185 -         TEGL Windows Toolkit
  10909.  
  10910.  
  10911.  
  10912.  
  10913.  
  10914.                         Chapter 10 - Animation
  10915.  
  10916. Syntax
  10917.                    void animateinit(void)
  10918. See also
  10919.                    resetframe
  10920.  
  10921.  
  10922.  
  10923. ___________________________________________________________________________
  10924.  
  10925. animate                                                                    
  10926. ___________________________________________________________________________
  10927.  
  10928.  
  10929. Function
  10930.                    Begins the Animation Sequence.
  10931. Syntax
  10932.                    animate(animateobject *ao, unsigned numframe);
  10933. Remarks
  10934.                    numframe is the number of frames to animate. If
  10935.                    the number of frames in a sequence is less then the
  10936.                    requested numframe, then the sequence loops to the
  10937.                    beginning.
  10938. Restrictions
  10939.                    Since animate uses two video pages, the function 
  10940.                    animateinit must be called to replicate the first page
  10941.                    to the second.
  10942. See also
  10943.                    resetframe, destination
  10944.  
  10945.  
  10946.  
  10947. ___________________________________________________________________________
  10948.  
  10949. animatecomplete                                                            
  10950. ___________________________________________________________________________
  10951.  
  10952.  
  10953. Function
  10954.                    Closes the animation sequence.
  10955. Syntax
  10956.                    void animatecomplete(animateobject *ao);
  10957. Remarks
  10958.                    complete toggles the sound off and resets the
  10959.                    frame to the beginning.
  10960.  
  10961.  
  10962.  
  10963. Example Animation
  10964.  
  10965.  
  10966.  
  10967.  Programmer's Reference Guide       - 186 -         TEGL Windows Toolkit
  10968.  
  10969.  
  10970.  
  10971.  
  10972.  
  10973.                         Chapter 10 - Animation
  10974.  
  10975.  
  10976.  
  10977. #include <stdio.h>
  10978. #include <graphics.h>
  10979. #include "teglsys.h"
  10980.  
  10981. animateobject bounceicon;
  10982.  
  10983. void main()
  10984. {
  10985.     easytegl();
  10986.  
  10987.     init(&bounceicon);
  10988.     addframe(&bounceicon,imageBLANKBUT,-15,0,14,37,10,0,0,BLACK);
  10989.     sequence(&bounceicon,1);
  10990.  
  10991.     resetsequence(&bounceicon);
  10992.     addframe(&bounceicon,imageBLANKBUT,15,0,14,37,10,0,0,BLACK);
  10993.     sequence(&bounceicon,2);
  10994.  
  10995.     origin(&bounceicon,getmaxx() / 2,getmaxy() / 2);
  10996.  
  10997.     animateinit();
  10998.  
  10999.     clearkeyboardbuf();
  11000.  
  11001.     while (!kbhit())
  11002.        {
  11003.           sequence(&bounceicon,1);
  11004.           animate(&bounceicon,destination(&bounceicon,36,0));
  11005.  
  11006.           sequence(&bounceicon,2);
  11007.           animate(&bounceicon,destination(&bounceicon,560,0));
  11008.        }
  11009.  
  11010.     teglsupervisor();
  11011. }
  11012.  
  11013.  
  11014.  
  11015.  
  11016.  
  11017.  
  11018.  
  11019.  
  11020.  
  11021.  
  11022.  
  11023.  
  11024.  
  11025.  
  11026.  Programmer's Reference Guide       - 187 -         TEGL Windows Toolkit
  11027.  
  11028.  
  11029.  
  11030.  
  11031.  
  11032.                       Chapter 11 - Writing Text
  11033.  
  11034.  
  11035. Writing Text
  11036. ___________________________________________________________________________
  11037.  
  11038. the teglwrt module provides the tools to write to the screen using
  11039. proportional bit-mapped fonts. Unlike BGI fonts, a font may be as
  11040. small as 5 pixels high and 3 pixels wide.
  11041.  
  11042. Both BGI vector fonts and TEGL bit-mapped fonts may be used together.
  11043. Like the BGI outtextxy procedure, teglouttextxy is affected by
  11044. the settextjustify procedure. To turn off the proportional
  11045. print, use the procedure setproportional(FALSE).
  11046.  
  11047. TEGLWrt Variables
  11048.  
  11049. Bit-mapped Fonts
  11050.  
  11051. There are 25 bit-mapped fonts available in the teglwrt module
  11052. They are:
  11053.  
  11054.  
  11055. font09      font14     countdwn     oenglish       script      ocr
  11056. fraktur     italic     georgian     apls7          pc9         gaelic
  11057. litalic     pc24       pc3270       m3270          ega09       future
  11058. broadway    script2    lcdfont      light14        brdwx19     sansx19
  11059. wndwx19     light9
  11060.  
  11061.  
  11062. To select a font, just pass it to setteglfont.
  11063. eg. setteglfont(countdwn).
  11064.  
  11065. Creating Your Own Bit-mapped Fonts
  11066.  
  11067. You can create and add your own fonts by modifying the assembler files
  11068. then assembling the new font to to an object file.  Each bit in a byte
  11069. represents a pixel of the font.
  11070.  
  11071. The format of a TEGL font is:
  11072.  
  11073.  
  11074.  
  11075.     1 byte header - indicating the height of the font.
  11076.  
  11077.     Each character is:
  11078.     1 byte  - proportional font width
  11079.     n bytes - defined by the 1 byte header
  11080.  
  11081.  
  11082.  
  11083.  
  11084.  
  11085.  Programmer's Reference Guide       - 188 -         TEGL Windows Toolkit
  11086.  
  11087.  
  11088.  
  11089.  
  11090.  
  11091.                       Chapter 11 - Writing Text
  11092.  
  11093. TEGLWrt Functions and Procedures
  11094.  
  11095. fmttegltextxy and outtegltextxy will display characters with
  11096. underlines. To underline a character in a string, use the macros defined
  11097. in teglsys.h (A_, B_, C__....._Z_), to append to your string.
  11098.  
  11099. The following example will underline the T in TEGL.
  11100.  
  11101.  
  11102.      outtegltextxy(100,100,T_"EGL systems corporation");
  11103.  
  11104.  
  11105.  
  11106.  
  11107. ___________________________________________________________________________
  11108.  
  11109. fmttegltextxy                                                              
  11110. ___________________________________________________________________________
  11111.  
  11112.  
  11113. Function
  11114.                    Writes formatted output to the graphics screen.
  11115. Syntax
  11116.                    void fmttegltextxy(int x, int y,
  11117.                       char *fmt [,argument . . .]);
  11118. Remarks
  11119.                    fmttegltextxy is affected by the justification
  11120.                    settings set by settextjustify and color by 
  11121.                    setcolor.
  11122.  
  11123.                    x,y is the coordinates of the graphic screen.
  11124.  
  11125.                    fmt is the format string. See printf for a
  11126.                    complete discription on format specifications.
  11127.  
  11128.                    fonttable is a global variable which is used to
  11129.                    set the pointer to an internal font table.
  11130. See also
  11131.                    printf
  11132.  
  11133.  
  11134.  
  11135. ___________________________________________________________________________
  11136.  
  11137. outtegltextxy                                                              
  11138. ___________________________________________________________________________
  11139.  
  11140.  
  11141. Function
  11142.                    Writes mystr to the graphics screen at x,y.
  11143.  
  11144.  Programmer's Reference Guide       - 189 -         TEGL Windows Toolkit
  11145.  
  11146.  
  11147.  
  11148.  
  11149.  
  11150.                       Chapter 11 - Writing Text
  11151.  
  11152. Syntax
  11153.                    void outtegltextxy(int x, int y, char *mystr);
  11154. Remarks
  11155.                    outtegltextxy is affected by the justification
  11156.                    settings set by settextjustify and color by 
  11157.                    setcolor.
  11158.  
  11159.                    x,y is the coordinates of the graphic screen.
  11160.  
  11161.                    mystr is the text string for output.
  11162.  
  11163.                    fonttable is a global variable which is used to
  11164.                    set the pointer to an internal font table.
  11165. See also
  11166.                    teglwrtchar
  11167. Example
  11168.  
  11169.  
  11170.   settextjustify(CENTER_TEXT,CENTER_TEXT);
  11171.   setcolor(GREEN);
  11172.   setteglfont(script);
  11173.   outtegltextxy(100,100,"TEGL systems corporation");
  11174.  
  11175.  
  11176.  
  11177.  
  11178.  
  11179.  
  11180. ___________________________________________________________________________
  11181.  
  11182. tegltextwidth                                                              
  11183. ___________________________________________________________________________
  11184.  
  11185.  
  11186. Function
  11187.                    Returns the proportional width of mystr.
  11188. Syntax
  11189.                    int tegltextwidth(char *mystr);
  11190. Remarks
  11191.                    TEGLTextWidth will scan and total the exact number
  11192.                    of pixels mystr will occupy.
  11193. Restrictions
  11194.                    Any unprintable characters will not be included in the
  11195.                    final size.
  11196. See also
  11197.                    teglcharwidth, teglcharheight
  11198.  
  11199.  
  11200.  
  11201. ___________________________________________________________________________
  11202.  
  11203.  Programmer's Reference Guide       - 190 -         TEGL Windows Toolkit
  11204.  
  11205.  
  11206.  
  11207.  
  11208.  
  11209.                       Chapter 11 - Writing Text
  11210.  
  11211.  
  11212. teglcharwidth                                                              
  11213. ___________________________________________________________________________
  11214.  
  11215.  
  11216. Function
  11217.                    Returns the proportional width of a character.
  11218. Syntax
  11219.                    int teglcharwidth(int c);
  11220. Remarks
  11221.                    c is the ordinal value of the character.
  11222.  
  11223.                    teglcharwidth will return a value based on the
  11224.                    currently selected font.
  11225. Restrictions
  11226.                    Characters outside the 28-126 ascii code will return a
  11227.                    invalid size.
  11228. See also
  11229.                    tegltextwidth, teglcharheight
  11230.  
  11231.  
  11232.  
  11233. ___________________________________________________________________________
  11234.  
  11235. teglcharheight                                                             
  11236. ___________________________________________________________________________
  11237.  
  11238.  
  11239. Function
  11240.                    Returns the height of the proportional font.
  11241. Syntax
  11242.                    int teglcharheight(void);
  11243. Remarks
  11244.                    teglcharheight will return to the first byte in
  11245.                    the font table which is the height of the current font.
  11246. See also
  11247.                    tegltextwidth, teglcharwidth
  11248.  
  11249.  
  11250.  
  11251. ___________________________________________________________________________
  11252.  
  11253. teglwrtchar                                                                
  11254. ___________________________________________________________________________
  11255.  
  11256.  
  11257. Function
  11258.                    Writes a single character to the graphics screen.
  11259. Syntax
  11260.                    void teglwrtchar(int c, int x,int y, int color);
  11261.  
  11262.  Programmer's Reference Guide       - 191 -         TEGL Windows Toolkit
  11263.  
  11264.  
  11265.  
  11266.  
  11267.  
  11268.                       Chapter 11 - Writing Text
  11269.  
  11270. Remarks
  11271.                    x,y specifies the coordinates for writing the
  11272.                    character.
  11273.  
  11274.                    c is the ascii code of the character. Valid
  11275.                    character range is 28-126.
  11276.  
  11277.                    color is color of the output character.
  11278. See also
  11279.                    teglouttextxy
  11280.  
  11281.  
  11282.  
  11283.  
  11284. ___________________________________________________________________________
  11285.  
  11286. setproportional                                                            
  11287. ___________________________________________________________________________
  11288.  
  11289.  
  11290. Function
  11291.                    Switch Proportional font on or off.
  11292. Syntax
  11293.                    Macro
  11294.                    void setproportional( char onoff);
  11295. Remarks
  11296.                    Default is proportional font on TRUE. If
  11297.                    proportional font is off FALSE, the spacing is 8
  11298.                    bits.
  11299.  
  11300.  
  11301.  
  11302. ___________________________________________________________________________
  11303.  
  11304. setteglfont                                                                
  11305. ___________________________________________________________________________
  11306.  
  11307.  
  11308. Function
  11309.                    Sets the font to use in subsequent calls to
  11310.                    outtegltextxy.
  11311. Syntax
  11312.                    void setteglfont( fontptr p);
  11313. Remarks
  11314.                    This procedure simply sets the fonttable variable
  11315.                    to point to p.
  11316.  
  11317.  
  11318. Showing ALL Fonts FONTTEST.PAS
  11319.  
  11320.  
  11321.  Programmer's Reference Guide       - 192 -         TEGL Windows Toolkit
  11322.  
  11323.  
  11324.  
  11325.  
  11326.  
  11327.                       Chapter 11 - Writing Text
  11328.  
  11329. The TEGL.C demonstration program uses the fonttest module to display
  11330. all available fonts, or, individual fonts by selecting from a menu.
  11331.  
  11332.  
  11333. ___________________________________________________________________________
  11334.  
  11335. fontname                                                                   
  11336. ___________________________________________________________________________
  11337.  
  11338.  
  11339. Function
  11340.                    Returns the name of a font.
  11341. Syntax
  11342.                    char *fontname( unsigned fontnum);
  11343. Remarks
  11344.                    fontname is used to build the menu for selective
  11345.                    display of fonts.
  11346. See also
  11347.                    showonefont, showfonts
  11348.  
  11349.  
  11350.  
  11351. ___________________________________________________________________________
  11352.  
  11353. showonefont                                                                
  11354. ___________________________________________________________________________
  11355.  
  11356.  
  11357. Function
  11358.                    An Event that displays a font based on
  11359.                    mouseclickpos->clicknumber.
  11360. Syntax
  11361.                    unsigned showonefont(imagestkptr ifs, msclickptr ms);
  11362. See also
  11363.                    FontName, ShowFonts
  11364.  
  11365.  
  11366.  
  11367. ___________________________________________________________________________
  11368.  
  11369. showfonts                                                                  
  11370. ___________________________________________________________________________
  11371.  
  11372.  
  11373. Function
  11374.                    An Event that displays all fonts.
  11375. Syntax
  11376.                    unsigned showfonts(imagestkptr frame, msclickptr ms); 
  11377. Remarks
  11378.                    An Event that displays all the available fonts and
  11379.  
  11380.  Programmer's Reference Guide       - 193 -         TEGL Windows Toolkit
  11381.  
  11382.  
  11383.  
  11384.  
  11385.  
  11386.                       Chapter 11 - Writing Text
  11387.  
  11388.                    their respective names.
  11389. See also
  11390.                    fontname, showonefont
  11391.  
  11392.  
  11393.  
  11394.  
  11395.  
  11396.  
  11397.  
  11398.  
  11399.  
  11400.  
  11401.  
  11402.  
  11403.  
  11404.  
  11405.  
  11406.  
  11407.  
  11408.  
  11409.  
  11410.  
  11411.  
  11412.  
  11413.  
  11414.  
  11415.  
  11416.  
  11417.  
  11418.  
  11419.  
  11420.  
  11421.  
  11422.  
  11423.  
  11424.  
  11425.  
  11426.  
  11427.  
  11428.  
  11429.  
  11430.  
  11431.  
  11432.  
  11433.  
  11434.  
  11435.  
  11436.  
  11437.  
  11438.  
  11439.  Programmer's Reference Guide       - 194 -         TEGL Windows Toolkit
  11440.  
  11441.  
  11442.  
  11443.  
  11444.  
  11445.                       Chapter 12 - Events
  11446.  
  11447. Events Library
  11448. ___________________________________________________________________________
  11449.  
  11450. The Event's covered here span over several modules. They may be used
  11451. immediately in programming an application.
  11452.  
  11453. The File Selector
  11454.  
  11455. The file selector selectafile provides a dialogue event, that
  11456. displays the files of a directory and lets the user select one of the
  11457. existing files or enter a new file name.
  11458.  
  11459. The file selector dialogue box allows the user to choose any displayed file
  11460. either by clicking on the file name and then clicking on the OK button or by
  11461. clicking on the selection area and typing in the filename.
  11462.  
  11463. To change directories, position the mouse cursor at a directory filename
  11464. and click or click at the bar at the top of the file selector window and
  11465. type in the directory path.
  11466.  
  11467. selectafile will return the full file name, including the directory
  11468. prefix, for the file selected.  If the Cancel button was clicked
  11469. or no file was selected, the file name returned will be a NULL.
  11470.  
  11471.  
  11472. ___________________________________________________________________________
  11473.  
  11474. selectafile                                                                
  11475. ___________________________________________________________________________
  11476.  
  11477.  
  11478. Function
  11479.                    Provides a file selection dialogue that allows a user
  11480.                    to choose or create a new filename.
  11481. Declaration
  11482.                    char selectafile(int x, int y, char *path,
  11483.                      char *fileselected);
  11484. Result type
  11485.                    Toolean. True if a file was selected. False if no file
  11486.                    was selected or the mouse clicked on the cancel button.
  11487.  
  11488. Remarks
  11489.                    x,y is the coordinates where the file selection
  11490.                    dialogue will be displayed.
  11491.  
  11492.                    path is the original directory path specification.
  11493.                    Use a global string variable to retain the last
  11494.                    directory path.
  11495.  
  11496.                    fileselected will contain the selected path and
  11497.  
  11498.  Programmer's Reference Guide       - 195 -         TEGL Windows Toolkit
  11499.  
  11500.  
  11501.  
  11502.  
  11503.  
  11504.                       Chapter 12 - Events
  11505.  
  11506.                    filename, if the function returns True.
  11507.  
  11508.  
  11509. String Editing Dialog
  11510.  
  11511. The EditString procedure provides a facility for getting text input
  11512. from the user.  The file selector uses this routine to get a new filename.
  11513.  
  11514.  
  11515. ___________________________________________________________________________
  11516.  
  11517. editstring                                                                 
  11518. ___________________________________________________________________________
  11519.  
  11520.  
  11521. Function
  11522.                    Provides string input facility.
  11523. Declaration
  11524.                    void editstring(imagestkptr fs, int x, int y,
  11525.                      int maxlen, char *textstr);
  11526. Remarks
  11527.                    fs is of the type imagestkptr, created by 
  11528.                    pushimage.
  11529.  
  11530.                    x,y is the relative coordinates from the upper
  11531.                    left of fs where a blinking vertical bar and text
  11532.                    input will be displayed.
  11533.  
  11534.                    maxlen is the number of maximum number of input
  11535.                    characters.
  11536.  
  11537.                    textstr is the user input string.
  11538. Restrictions
  11539.                    String editing should be on the topmost window.
  11540. Example
  11541.  
  11542.  
  11543.   char mystring[12];
  11544.  
  11545.   pushimage(100,100,150,150);
  11546.   setteglfont(font14);
  11547.   editstring(stackptr,5,5,12,&mystring);
  11548.  
  11549.  
  11550.  
  11551.  
  11552.  
  11553. Mouse Sensitivity Dialogue Window
  11554.  
  11555. The mouse sensitivity dialogue box allows the user to change the horizontal,
  11556.  
  11557.  Programmer's Reference Guide       - 196 -         TEGL Windows Toolkit
  11558.  
  11559.  
  11560.  
  11561.  
  11562.  
  11563.                       Chapter 12 - Events
  11564.  
  11565. vertical and threshold settings of the mouse. The dialogue box consists of
  11566. radio type buttons that can adjust the numeric counters.
  11567.  
  11568.  
  11569. ___________________________________________________________________________
  11570.  
  11571. setmousesense                                                              
  11572. ___________________________________________________________________________
  11573.  
  11574.  
  11575. Function
  11576.                    Provides a mouse sensitivity dialogue window that
  11577.                    allows the user to change the sensitivity setting of
  11578.                    the mouse.
  11579. Declaration
  11580.                    void setmousesense(int x, int y);
  11581. Remarks
  11582.                    x,y is the coordinates where the SetMouseSense
  11583.                    dialogue will be displayed.
  11584. Restrictions
  11585.                    The dialogue does not check if the mouse is present.
  11586. Example
  11587.  
  11588.  
  11589.   unsigned askmousesense(imagestkptr frame,
  11590.              msclickptr mouseclickpos);
  11591.    {
  11592.       setmousesense(160,75);
  11593.       return(1);
  11594.    }
  11595.  
  11596.  
  11597.  
  11598.  
  11599.  
  11600. Bells & Whistles, Sound Unit
  11601.  
  11602. the asksoundsense dialogue window allows the user to change the duration
  11603. of the beeps and whistle settings of the sound unit. The dialogue box consists
  11604. of radio type buttons that can adjust the numeric counters.
  11605.  
  11606.  
  11607. ___________________________________________________________________________
  11608.  
  11609. asksoundsense                                                              
  11610. ___________________________________________________________________________
  11611.  
  11612.  
  11613. Function
  11614.                    A sound duration dialogue event
  11615.  
  11616.  Programmer's Reference Guide       - 197 -         TEGL Windows Toolkit
  11617.  
  11618.  
  11619.  
  11620.  
  11621.  
  11622.                       Chapter 12 - Events
  11623.  
  11624. Syntax
  11625.                    unsigned asksoundsense( imagestkptr frame,
  11626.                      msclickptr ms);
  11627. Remarks
  11628.                    An event that displays a dialogue box that permits the
  11629.                    user to set the sound duration for beeps and whistles.
  11630.  
  11631.  
  11632.  
  11633. ___________________________________________________________________________
  11634.  
  11635. beep                                                                       
  11636. ___________________________________________________________________________
  11637.  
  11638.  
  11639. Function
  11640.                    Toggles the sound on for a specific tone and 
  11641.                    duration for n times.
  11642. Declaration
  11643.                    void beep(unsigned tone, unsigned n,
  11644.                      unsigned duration);
  11645. Remarks
  11646.                    tone specifies the frequency of the emitted sound
  11647.                    in hertz.
  11648.  
  11649.                    n specifies the number of times the sound it
  11650.                    toggle on and off.
  11651.  
  11652.                    duration specifies the length in milliseconds of
  11653.                    the sound.
  11654. See also
  11655.                    slidebeep, soundswitch
  11656. Example
  11657.  
  11658.  
  11659.  
  11660.   beep(1000,3,100);
  11661.  
  11662.  
  11663.  
  11664.  
  11665.  
  11666.  
  11667. ___________________________________________________________________________
  11668.  
  11669. slidebeep                                                                  
  11670. ___________________________________________________________________________
  11671.  
  11672.  
  11673. Function
  11674.  
  11675.  Programmer's Reference Guide       - 198 -         TEGL Windows Toolkit
  11676.  
  11677.  
  11678.  
  11679.  
  11680.  
  11681.                       Chapter 12 - Events
  11682.  
  11683.                    Performs a sliding type of sound. Whistle type.
  11684. Declaration
  11685.                    void slidebeep(unsigned tone1, unsigned tone2,
  11686.                      unsigned n);
  11687. Remarks
  11688.                    tone1 specifies the initial frequency of the
  11689.                    emitted sound in hertz. tone2 specifies the second
  11690.                    frequency from which tone1 steps towards.
  11691.  
  11692.                    n specifies the number of times the slide beep
  11693.                    occurs.
  11694. See also
  11695.                    beep, soundswitch
  11696. Example
  11697.  
  11698.  
  11699.   slidebeep(1000,2000,2);
  11700.  
  11701.  
  11702.  
  11703.  
  11704.  
  11705. ___________________________________________________________________________
  11706.  
  11707. soundswitch                                                                
  11708. ___________________________________________________________________________
  11709.  
  11710.  
  11711. Function
  11712.                    Switches the sound function on/off.
  11713. Declaration
  11714.                    void soundswitch(char onoff);
  11715. Remarks
  11716.                    onoff switches the sound on-1 or off-0.
  11717. See also
  11718.                    beep, slidebeep
  11719.  
  11720.  
  11721.  
  11722.  
  11723.  
  11724.  
  11725.  
  11726.  
  11727.  
  11728.  
  11729.  
  11730.  
  11731.  
  11732.  
  11733.  
  11734.  Programmer's Reference Guide       - 199 -         TEGL Windows Toolkit
  11735.  
  11736.  
  11737.  
  11738.  
  11739.  
  11740.                  Chapter 13 - Virtual Memory Manager
  11741.  
  11742. Virtual Memory Manager
  11743. ___________________________________________________________________________
  11744. Graphical images, by their nature, require a tremendous amount of memory
  11745. to store and manipulate. Combine this with the DOS limitation of 640k,
  11746. writing applications using a graphical environment can be limiting.
  11747.  
  11748. Virtual Memory is a concept by which less expensive mass storage devices
  11749. (ie. hard disk) may be used as though it were an extension of memory. Then
  11750. memory is only limited by the size of the hard disk.
  11751.  
  11752. The TEGL virtual memory manager may be used within your application
  11753. program independent of its use within the TEGL window manager.
  11754.  
  11755. In this chapter, we provide technical information for advanced
  11756. programmers. We'll cover topics such as the Virtual Memory Manager, Turbo
  11757. C's heap manager, Expanded Memory Manager, calling conventions, and
  11758. more.
  11759.  
  11760. malloc, calloc, free, and other Turbo C memory allocation functions
  11761. are replaced in TEGL by cgetmem and  cfreemem. cgetmem
  11762. and cfreemem are available in TEGL for memory allocation within your
  11763. Turbo C functions.
  11764.  
  11765. When cgetmem is used, the virtual memory manager will automatically
  11766. swap any images, that is not currently active, to EMS or your hard disk, thus
  11767. freeing enough memory to fulfill your request.
  11768.  
  11769.  
  11770. Heap Management
  11771. With Window Management routines, the memory requirement is unknown. If we
  11772. were to attempt to ensure that memory is available for every window that
  11773. is created within the program, we would have an unwieldy and unjustifiably
  11774. large program. In actual fact, any modest application would require much
  11775. more memory than is available.
  11776.  
  11777. Rather then attempting to reserve a fixed amount of memory space, which
  11778. places a limitation on the program, the heap provides the facility of
  11779. allocating memory dynamically. The heap permits us to allocate memory only
  11780. when it is required and to release the memory when the task is completed.
  11781.  
  11782. The Heap Manager
  11783.  
  11784. When the virtual memory manager is initialized, a block of memory is
  11785. allocated from Turbo C's far heap.  The default when initializing from 
  11786. teglinit(), is all the remaining memory that is left when a program is
  11787. executed.  If you need to reserve a part of the far heap for C library
  11788. functions (eg.  file streams), that uses malloc, calloc etc.  you can
  11789. use the Macro setheapmemmaxsize(maxsize) to reduce the virtually
  11790. memory manager from grabbing all of the far heap.
  11791.  
  11792.  
  11793.  Programmer's Reference Guide       - 200 -         TEGL Windows Toolkit
  11794.  
  11795.  
  11796.  
  11797.  
  11798.  
  11799.                  Chapter 13 - Virtual Memory Manager
  11800.  
  11801. The virtual memory manager is identical with Turbo C's heap manager, in its
  11802. operation of allocating from the reserved memory starting starting with the
  11803. lowest part of the heap growing upwards.  The bottom of the heap is stored
  11804. in the variable heaporg.  Each time a block of memory is allocated on
  11805. the heap (via cgetmem or fgetmem), the heap manage moves 
  11806. heapptr upward by the size of the requested block.
  11807.  
  11808. The top of the heap, or the maximum size of the heap is controlled by the
  11809. variable freeptr. It does not point directly at the maximum top,
  11810. rather it points at the start of the free pointer chain.
  11811.  
  11812. The free pointer chain grows downward as memory blocks are freed. Adjacent
  11813. memory blocks are always combined to form larger blocks.
  11814.  
  11815. The Virtual Heap Manager allows us to allocate memory blocks that are
  11816. greater than 64k.  A full EGA screen image (640x350 -16 colors) is
  11817. approximately 109k.
  11818.  
  11819. The cgetmem differs from fgetmem in that the virtual heap manager
  11820. will search through the free space chain and reuses the first available
  11821. memory block that can accommodate the request.
  11822. When a memory request is made to fgetmem, the manager will
  11823. attempt to allocate memory between HeapPtr and FreePtr first,
  11824. before attempting to find space on the free space list.
  11825.  
  11826. fgetmem is normally not used as part of your TEGL application.
  11827.  
  11828. The TEGL Heap Error Function
  11829. The hugeheaperror variable allows you to install a heap error function,
  11830. which gets called whenever the TEGL heap manager cannot complete an allocation
  11831. request. hugeheaperror is a pointer that points to a function with the
  11832. following header:
  11833.  
  11834.  
  11835.  
  11836.     int myheaperror(unsigned long heapsize)
  11837.  
  11838.  
  11839.  
  11840. The TEGL heap error function is installed by assigning its address to the
  11841. hugeheaperror variable:
  11842.  
  11843.  
  11844.  
  11845.     hugeheaperror = myheaperror;
  11846.  
  11847.  
  11848.  
  11849. The TEGL heap error function gets called whenever a call to cgetmem
  11850. cannot complete the request. The size parameter contains the size of
  11851.  
  11852.  Programmer's Reference Guide       - 201 -         TEGL Windows Toolkit
  11853.  
  11854.  
  11855.  
  11856.  
  11857.  
  11858.                  Chapter 13 - Virtual Memory Manager
  11859.  
  11860. the block that could not be allocated, and the TEGL heap error function
  11861. should attempt to free a block of at least that size.
  11862.  
  11863. Depending on its success, the TEGL heap error function may return a 1 or 2.
  11864. A return of 2 indicates success and causes a retry (which could also cause
  11865. another call to the TEGL heap error function). A return of any other value
  11866. will cause cgetmem to return a NULL pointer.
  11867.  
  11868. The standard TEGL heap error function always returns a 1, causing
  11869. cgetmem to return a NULL pointer.
  11870.  
  11871. TEGLunit sets the heap error function to point to the virtual memory
  11872. manager. Don't use the heap error function if you are using TEGLUnit,
  11873. the virtual memory handler depends on this function to know when its time
  11874. to start paging out window buffers.
  11875.  
  11876. The TEGL Heap Manager Functions
  11877.  
  11878.  
  11879. ___________________________________________________________________________
  11880.  
  11881. cgetmem                                                                    
  11882. ___________________________________________________________________________
  11883.  
  11884.  
  11885. Function
  11886.                    Returns a pointer to a memory block of the specified
  11887.                    size.
  11888. Syntax
  11889.                    void far * cgetmem(unsigned long heapsize)
  11890. Remarks
  11891.                    Returns a (void) pointer.  Size is a unsigned long
  11892.                    specifying the size, in bytes, of the memory block to
  11893.                    allocate.
  11894.  
  11895.                    If there isn't enough free space on the heap to
  11896.                    allocate the memory block, the return pointer is NULL.
  11897.                    A user defined run-time error procedure can be used to
  11898.                    intercept any heap errors (see hugeheaperror).
  11899.  
  11900. Restrictions
  11901.                    There are actually no restrictions on the size of the
  11902.                    largest block that can be allocated, however, DOS
  11903.                    limits you to the remaining memory after the program is
  11904.                    loaded.
  11905. See also
  11906.                    cfreemem
  11907. Example
  11908.                    Allocates and frees a 128k buffer.
  11909.  
  11910.  
  11911.  Programmer's Reference Guide       - 202 -         TEGL Windows Toolkit
  11912.  
  11913.  
  11914.  
  11915.  
  11916.  
  11917.                  Chapter 13 - Virtual Memory Manager
  11918.  
  11919.  
  11920. #include "teglsys.h"
  11921.  
  11922. void main()
  11923. {
  11924.   char far * buffer;
  11925.  
  11926.   buffer = cgetmem(131072);
  11927.   cfreemem(buffer,131072);
  11928. }
  11929.  
  11930.  
  11931.  
  11932.  
  11933.  
  11934. ___________________________________________________________________________
  11935.  
  11936. cfreemem                                                                   
  11937. ___________________________________________________________________________
  11938.  
  11939.  
  11940. Function
  11941.                    Frees a memory block and returns the memory back to the
  11942.                    heap manager.
  11943. Syntax
  11944.                    void cfreemem(void far * freeorgptr,
  11945.                       unsigned long heapsize)
  11946. Remarks
  11947.                    freeorgptr is a pointer variable of any pointer type
  11948.                    that was previously assigned by the cgetmem or 
  11949.                    fgetmem function.  Size is an unsigned long specifying the
  11950.                    size of the memory block, in bytes, to be freed; it must be
  11951.                    exactly the same number of bytes previously allocated
  11952.                    to that memory block by cgetmem or fgetmem.  
  11953.                    cfreemem returns the memory region to the TEGL heap.
  11954. Restrictions
  11955.                    Do not use cfreemem to free up memory allocated by
  11956.                    Turbo's C heap manager.
  11957. See also
  11958.                    cgetmem
  11959.  
  11960.  
  11961. Expanded Memory Manager (EMM)
  11962.  
  11963. The Expanded Memory Manager is a device driver that controls and manages
  11964. expanded memory and application programs that use expanded memory.
  11965.  
  11966. Expanded memory is memory beyond DOS's 640K-byte limit.  The Expanded
  11967. Memory specification (EMS) supports up to 32M bytes of expanded memory.
  11968. Because the 8086, 8088, and 80286 (in real mode) microprocessors can
  11969.  
  11970.  Programmer's Reference Guide       - 203 -         TEGL Windows Toolkit
  11971.  
  11972.  
  11973.  
  11974.  
  11975.  
  11976.                  Chapter 13 - Virtual Memory Manager
  11977.  
  11978. physically address only 1M byte of memory, they access expanded memory
  11979. through a window in their physical address range.
  11980.  
  11981. This is similar to a book, where pages within the book can retain data.
  11982. However, just like a book, if you wish to retrieve the data, you must
  11983. supply the page number.  As well, when you first create the book
  11984. (returning a handle) the initial number of pages must be specified.  If
  11985. you require more pages after the initial allocation, a new book must be
  11986. created (Version 3.2 EMS did not provide a function that allows you to
  11987. expand the initial allocation with the same handle).
  11988.  
  11989. There are approximately 30 EMS functions calls available with EMS Version
  11990. 4.0; as documented in the specification produced jointly by Lotus
  11991. Development Corporation, Intel Corporation, and Microsoft Corporation.  A
  11992. copy of this documentation (Part number 300275-005) October, 1987, can be
  11993. obtained from Intel Corporation, 3065 Bowers Avenue, Santa Clara, CA
  11994. 95051.
  11995.  
  11996. However, EMM Version 3.2 is still widely used as the driver on most systems,
  11997. and therefore we are limited in terms of compatibility, to the number of
  11998. functions that may be used.
  11999.  
  12000.  
  12001. Expanded Memory Functions
  12002.  
  12003.  
  12004. ___________________________________________________________________________
  12005.  
  12006. emminstalled                                                               
  12007. ___________________________________________________________________________
  12008.  
  12009.  
  12010. Function
  12011.                    Returns an installed status on the Expanded Memory
  12012.                    Manager.
  12013. Syntax
  12014.                    char emminstalled(void)
  12015. Result type
  12016.                    Returns a char status of 1, if an EMM driver is
  12017.                    installed on the system, 0 if not installed.
  12018. Remarks
  12019.                    This function uses the address that is found in the Int
  12020.                    67H vector to inspect the device header of the presumed
  12021.                    EMM. If the EMM is present, the name field at offset
  12022.                    0AH of the device header will contain the string
  12023.                    EMMXXXX0.
  12024.  
  12025.  
  12026.  
  12027.  
  12028.  
  12029.  Programmer's Reference Guide       - 204 -         TEGL Windows Toolkit
  12030.  
  12031.  
  12032.  
  12033.  
  12034.  
  12035.                  Chapter 13 - Virtual Memory Manager
  12036.  
  12037. ___________________________________________________________________________
  12038.  
  12039. emspagesavailable                                                          
  12040. ___________________________________________________________________________
  12041.  
  12042.  
  12043. Function
  12044.                    Obtains the total number of expanded memory pages
  12045.                    present in the systems, and the number of those pages
  12046.                    that are not already allocated.
  12047. Syntax
  12048.                    unsigned emspagesavailable(unsigned
  12049.                      *total_ems_pages, unsigned * pages_available)
  12050. Result type
  12051.                    Returns a return code of 0 if EMM software is
  12052.                    successful. A return code other then 0 indicates a
  12053.                    possible error in the EMM software or a memory hardware
  12054.                    error.
  12055. Remarks
  12056.                    This function may be used to determine the number of
  12057.                    pages available before allocating EMS pages.
  12058.  
  12059.  
  12060.  
  12061.  
  12062. ___________________________________________________________________________
  12063.  
  12064. allocateexpandedmemorypages                                                
  12065. ___________________________________________________________________________
  12066.  
  12067.  
  12068. Function
  12069.                    Allocates the requested number of pages (16k per page)
  12070.                    and returns a handle that is used to reference the
  12071.                    allocated pages.
  12072. Syntax
  12073.                    unsigned allocateexpandedmemorypages(unsigned
  12074.                        pages_needed, unsigned * handle)
  12075. Result type
  12076.                    Returns a return code of 0 if EMM software is
  12077.                    successful. A return code of $88 indicates that the
  12078.                    requested sh PagesNeeded is greater then the number
  12079.                    of pages that is currently available in the system.
  12080. See also
  12081.                    mapexpandedmemorypages, getpageframebaseaddress,
  12082.                    deallocateexpandedmemorypages
  12083.  
  12084.  
  12085.  
  12086.  
  12087.  
  12088.  Programmer's Reference Guide       - 205 -         TEGL Windows Toolkit
  12089.  
  12090.  
  12091.  
  12092.  
  12093.  
  12094.                  Chapter 13 - Virtual Memory Manager
  12095.  
  12096. ___________________________________________________________________________
  12097.  
  12098. mapexpandedmemorypages                                                     
  12099. ___________________________________________________________________________
  12100.  
  12101.  
  12102. Function
  12103.                    Maps one of the logical pages of expanded memory
  12104.                    assigned to a handle onto one of the four physical
  12105.                    pages within the EMM's page frame.
  12106. Syntax
  12107.                    unsigned mapexpandedmemorypages(unsigned handle,
  12108.                        unsigned logical_page,unsigned physical_page)
  12109. Result type
  12110.                    Returns a return code of 0 if EMM software is
  12111.                    successful. A return code of $8A indicates that the
  12112.                    logical page requested to be mapped is outside the
  12113.                    range of pages that is currently assigned to the
  12114.                    handle.
  12115. Remarks
  12116.                    A logical page is one page from the range of pages that
  12117.                    were allocated through the sh allocateexpandedmemorypages
  12118.                    function.  The logical-page number must be in the range 
  12119.                    {0_._._._n_-_1}}, where {it n} is the number of logical
  12120.                    pages previously allocated.
  12121.  
  12122.                    A physical page is one of four 16k byte pages, in the
  12123.                    range of 0-3, that may viewed as the window to the
  12124.                    expanded memory. Use sh getpageframebaseaddress to
  12125.                    obtain the segment address to the physical window.
  12126. See also
  12127.                    allocateexpandedmemorypages,
  12128.                    getpageframebaseaddress, deallocateexpandedmemorypages
  12129.  
  12130.  
  12131.  
  12132.  
  12133. ___________________________________________________________________________
  12134.  
  12135. getpageframebaseaddress                                                    
  12136. ___________________________________________________________________________
  12137.  
  12138.  
  12139. Function
  12140.                    Returns the segment address of the page frame used by
  12141.                    the Expanded Memory Manager.
  12142. Syntax
  12143.                    unsigned getpageframebaseaddress(unsigned
  12144.                        *page_frame_address)
  12145. Result type
  12146.  
  12147.  Programmer's Reference Guide       - 206 -         TEGL Windows Toolkit
  12148.  
  12149.  
  12150.  
  12151.  
  12152.  
  12153.                  Chapter 13 - Virtual Memory Manager
  12154.  
  12155.                    Returns a return code of 0 if EMM software is
  12156.                    successful. A return code other then 0 indicates a
  12157.                    possible error in the EMM software or a memory hardware
  12158.                    error.
  12159. Remarks
  12160.                    This is only the segment address of the physical page
  12161.                    frame. Use offsets of $0000 for physical page 0, offset
  12162.                    of $4000 for page 1, offset of $8000 for page 2 and
  12163.                    offset of $C000 for page 3.
  12164. See also
  12165.                    allocateexpandedmemorypages, mapexpandedmemorypages,
  12166.                    deallocateexpandedmemorypages
  12167.  
  12168.  
  12169.  
  12170.  
  12171. ___________________________________________________________________________
  12172.  
  12173. deallocateexpandedmemorypages                                              
  12174. ___________________________________________________________________________
  12175.  
  12176.  
  12177. Function
  12178.                    Deallocates (releases) the pages of expanded memory
  12179.                    currently assigned to a handle.
  12180. Syntax
  12181.                    unsigned deallocateexpandedmemorypages(unsigned
  12182.                        handle)
  12183. Result type
  12184.                    Returns a return code of 0 if EMM software is
  12185.                    successful.
  12186. Remarks
  12187.                    This function notifies the Expanded Memory Manager that
  12188.                    the application will not be making further use of the
  12189.                    allocated expanded memory pages. This function would
  12190.                    typically be called by a program just before performing
  12191.                    an exit.
  12192. See also
  12193.                    allocateexpandedmemorypages, mapexpandedmemorypages,
  12194.                    getpageframebaseaddress.
  12195.  
  12196.  
  12197.  
  12198.  
  12199. ___________________________________________________________________________
  12200.  
  12201. getversionnumber                                                           
  12202. ___________________________________________________________________________
  12203.  
  12204.  
  12205.  
  12206.  Programmer's Reference Guide       - 207 -         TEGL Windows Toolkit
  12207.  
  12208.  
  12209.  
  12210.  
  12211.  
  12212.                  Chapter 13 - Virtual Memory Manager
  12213.  
  12214. Function
  12215.                    Returns the EMM Version Number in a string format. A
  12216.                    handle.
  12217. Syntax
  12218.                    unsigned getversionnumber(char * version_string)
  12219. Result type
  12220.                    Returns a return code of 0 if EMM software is
  12221.                    successful. A return code other then 0 indicates a
  12222.                    possible error in the EMM software or a memory hardware
  12223.                    error.
  12224. Remarks
  12225.                    This function returns a EMM Version Number that may be
  12226.                    used to check if the installed EMM will support the
  12227.                    requested functions. However since Version 4.00 of the
  12228.                    expanded memory specification is downward compatible
  12229.                    with Version 3.2, this function is only useful as
  12230.                    information.
  12231.  
  12232.  
  12233.  
  12234. ___________________________________________________________________________
  12235.  
  12236. gethandlecountused                                                         
  12237. ___________________________________________________________________________
  12238.  
  12239.  
  12240. Function
  12241.                    Returns the number of total handles used by all
  12242.                    applications. a handle.
  12243. Syntax
  12244.                    unsigned gethandlecountused(unsigned
  12245.                      *numberofhandles)
  12246. Result type
  12247.                    Returns a return code of 0 if EMM software is
  12248.                    successful. A return code other then 0 indicates a
  12249.                    possible error in the EMM software or a memory hardware
  12250.                    error.
  12251. Remarks
  12252.                    The number of available handles depends on the
  12253.                    parameters used to start up the EMM driver, as well as
  12254.                    the number of handles in use by other resident or
  12255.                    multitasking software. The upper limit in Version 4.00
  12256.                    is 255 handles with a lower limit of 32. If the
  12257.                    returned number of handles is zero, the EMM is idle and
  12258.                    none of the expanded memory is in use.
  12259.  
  12260.  
  12261.  
  12262. ___________________________________________________________________________
  12263.  
  12264.  
  12265.  Programmer's Reference Guide       - 208 -         TEGL Windows Toolkit
  12266.  
  12267.  
  12268.  
  12269.  
  12270.  
  12271.                  Chapter 13 - Virtual Memory Manager
  12272.  
  12273. getpagesownedbyhandle                                                      
  12274. ___________________________________________________________________________
  12275.  
  12276.  
  12277. Function
  12278.                    Returns the number of expanded memory pages allocated
  12279.                    to a specific EMM handle.
  12280. Syntax
  12281.                    unsigned getpagesownedbyhandle(unsigned
  12282.                       handle, unsigned *pagesowned)
  12283. Result type
  12284.                    Returns a return code of 0 if EMM software is
  12285.                    successful.
  12286. Remarks
  12287.                    An EMM handle never has zero pages of memory allocated
  12288.                    to it.
  12289.  
  12290.  
  12291. Expanded Memory Test Program
  12292.  
  12293.  
  12294.  
  12295.  
  12296. #include "teglsys.h"
  12297.  
  12298. unsigned        emm_handle,
  12299.                 page_frame_base_address,
  12300.                 pages_needed,
  12301.                 physical_page,
  12302.                 logical_page,
  12303.                 offset,
  12304.                 error_code,
  12305.                 pages_ems_available,
  12306.                 total_handle_count,
  12307.                 pages_owned,
  12308.                 total_ems_pages,
  12309.                 available_ems_pages;
  12310.  
  12311. char            version_number[5],
  12312.                 Error_String[80],
  12313.                 verify;
  12314.  
  12315. char           *dataptr;
  12316.  
  12317. void
  12318. error(char *error_message, int error_number)
  12319. {
  12320.         printf("%sn", error_message);
  12321.         printf("  Error_Number = %Xn", error_number);
  12322.         printf("EMS test program aborting.n");
  12323.  
  12324.  Programmer's Reference Guide       - 209 -         TEGL Windows Toolkit
  12325.  
  12326.  
  12327.  
  12328.  
  12329.  
  12330.                  Chapter 13 - Virtual Memory Manager
  12331.  
  12332.         exit(1);
  12333. }
  12334.  
  12335.  
  12336. void
  12337. main()
  12338. {
  12339.         /*
  12340.          * Determine if the Expanded Memory Manager is installed, If not,
  12341.          * then terminate 'main' with an ErrorLevel code of 1.
  12342.          */
  12343.  
  12344.         if (!(emminstalled()))
  12345.         {
  12346.             printf("The LIM Expanded Memory Manager is not installed.n");
  12347.             exit(1);
  12348.         }
  12349.  
  12350.         /* Get the version number and display it  */
  12351.         error_code = getversionnumber(version_number);
  12352.         if (error_code != 0)
  12353.             error("Error trying to get the EMS version number ", error_code);
  12354.         else
  12355.             printf("LIM Expanded Memory Manager, version %s is ready for "
  12356.                    "use.nn", version_number);
  12357.  
  12358.  
  12359.         /*
  12360.          * Determine if there are enough expanded memory pages for this
  12361.          * application.
  12362.          */
  12363.         pages_needed = 1;
  12364.         error_code = emspagesavailable(&total_ems_pages,
  12365.                    &available_ems_pages);
  12366.  
  12367.         if (error_code != 0)
  12368.             error("Error trying to determine the number of EMS pages "
  12369.                   "available.", error_code);
  12370.  
  12371.         printf("There are a total of %d expanded memory pages present in this"
  12372.                " system.n", total_ems_pages);
  12373.         printf("  %d of those pages are available for your usage.nn",
  12374.                 available_ems_pages);
  12375.  
  12376.         /*
  12377.          * If there is an insufficient number of pages for our application,
  12378.          * then report the error and terminate the EMS test program
  12379.          */
  12380.         if (pages_needed > available_ems_pages)
  12381.         {
  12382.  
  12383.  Programmer's Reference Guide       - 210 -         TEGL Windows Toolkit
  12384.  
  12385.  
  12386.  
  12387.  
  12388.  
  12389.                  Chapter 13 - Virtual Memory Manager
  12390.  
  12391.             sprintf(Error_String, "We need %d EMS pages. There are not that "
  12392.                     "many available.", pages_needed);
  12393.  
  12394.             error(Error_String, error_code);
  12395.         }
  12396.  
  12397.         /* Allocate expanded memory pages for our usage  */
  12398.         error_code = allocateexpandedmemorypages(pages_needed, &emm_handle);
  12399.         sprintf(Error_String, "EMS test program failed trying to allocate %d"
  12400.                    " pages for usage.", pages_needed);
  12401.  
  12402.         if (error_code != 0)
  12403.             error(Error_String, error_code);
  12404.         printf("%d EMS page(s) allocated for the EMS test program.nn",
  12405.                    pages_needed);
  12406.  
  12407.         /*
  12408.          * Map in the required logical pages to the physical pages given to
  12409.          * us, in this case just one page
  12410.          */
  12411.         logical_page = 0;
  12412.         physical_page = 0;
  12413.         error_code = mapexpandedmemorypages(emm_handle, logical_page,
  12414.                    physical_page);
  12415.  
  12416.         if (error_code != 0)
  12417.             error("EMS test program failed trying to map logical pages onto"
  12418.                   " physical pages.", error_code);
  12419.  
  12420.         printf("Logical Page %d successfully mapped onto Physical Page "
  12421.                   "%dnn", logical_page, physical_page);
  12422.  
  12423.         /* Get the expanded memory page frame address  */
  12424.         error_code = getpageframebaseaddress(&page_frame_base_address);
  12425.         if (error_code != 0)
  12426.             error("EMS test program unable to get the base Page Frame "
  12427.                   "Address.", error_code);
  12428.  
  12429.         printf("The base address of the EMS page frame is - "
  12430.                "%X.nn",page_frame_base_address);
  12431.  
  12432.         /* Get Handle Count and the number of pages for our handle  */
  12433.         error_code = gethandlecountused(&total_handle_count);
  12434.         if (error_code != 0)
  12435.             error("EMS test program unable to get the Handle Count Used.",
  12436.                    error_code);
  12437.  
  12438.         error_code = getpagesownedbyhandle(emm_handle, &pages_owned);
  12439.         if (error_code != 0)
  12440.             error("EMS test program unable to get the number of pages Owned "
  12441.  
  12442.  Programmer's Reference Guide       - 211 -         TEGL Windows Toolkit
  12443.  
  12444.  
  12445.  
  12446.  
  12447.  
  12448.                  Chapter 13 - Virtual Memory Manager
  12449.  
  12450.                    "by handle.", error_code);
  12451.  
  12452.         printf("The Total Handle Count is %d and the number of Pages owned is"
  12453.                " %d.nn", total_handle_count, pages_owned);
  12454.  
  12455.         /* Write a test pattern to expanded memory  */
  12456.         for (offset = 0; offset <= 16382; offset++)
  12457.             pokeb(page_frame_base_address, offset, offset % 256);
  12458.  
  12459.         /* Make sure that what is in EMS memory is what we just wrote  */
  12460.         printf("Testing EMS memory.n");
  12461.  
  12462.         offset = 1;
  12463.         verify = 1;
  12464.         while ((offset <= 16382) && verify)
  12465.         {
  12466.             if (peekb(page_frame_base_address, offset) != offset % 256)
  12467.                 verify = 0;
  12468.             offset++;
  12469.         }
  12470.  
  12471.         /* If it isn't report the error  */
  12472.         if (!verify)
  12473.             error("What was written to EMS memory was not found during memory"
  12474.                    " verification test.", 0);
  12475.  
  12476.         printf("EMS memory test successful.nn");
  12477.  
  12478.  
  12479.         /*
  12480.          * Return the expanded memory pages given to us back to the EMS
  12481.          * memory pool before terminating our test program
  12482.          */
  12483.         error_code = deallocateexpandedmemorypages(emm_handle);
  12484.         if (error_code != 0)
  12485.             error("EMS test program was unable to deallocate the EMS pages in"
  12486.                   " use.", error_code);
  12487.  
  12488.         printf("%d page(s) deallocated.nn", pages_needed);
  12489.  
  12490.         printf("EMS test program completed.n");
  12491. }
  12492.  
  12493.  
  12494.  
  12495.  
  12496. A RAM Disk Driver
  12497.  
  12498. Expanded Memory (EMS), in its architecture of multiple pages, is limited
  12499. in its use as a direct access heap without complex programming. However,
  12500.  
  12501.  Programmer's Reference Guide       - 212 -         TEGL Windows Toolkit
  12502.  
  12503.  
  12504.  
  12505.  
  12506.  
  12507.                  Chapter 13 - Virtual Memory Manager
  12508.  
  12509. one of the simplest ways to take advantage of EMS, is to create a EMS ram
  12510. disk.
  12511.  
  12512. The following EMS RAM Disk functions provides the basics for storing and
  12513. retrieving a file from EMS memory.
  12514.  
  12515.  
  12516. ___________________________________________________________________________
  12517.  
  12518. emsopen                                                                    
  12519. ___________________________________________________________________________
  12520.  
  12521.  
  12522. Function
  12523.                    Opens an EMS Ram Disk file.
  12524. Syntax
  12525.                    emsfile emsopen(unsigned minimumpages)
  12526. Result type
  12527.                    EMSOpen returns a structure type of EMSFile.
  12528. Remarks
  12529.                    EMSFile is predeclared as follows:
  12530.  
  12531.  
  12532. typedef struct emsblock {
  12533.         emsblockptr     nextblockptr;
  12534.         unsigned        handle; /* Multiple handles */
  12535.         unsigned        emspage;/* Pages allocated */
  12536. }               emsblock;
  12537.  
  12538. typedef struct emsfilerec {
  12539.         unsigned        pageoffset;     /* current offset within page */
  12540.         unsigned        baseaddress;
  12541.         unsigned long   emsposition;
  12542.         unsigned        totalpages;     /* Total number of 16k pages */
  12543.         emsblockptr     rootblkptr;
  12544. }               emsfilerec;
  12545.  
  12546.  
  12547.  
  12548.                    The baseaddress and pageoffset forms the
  12549.                    pointer to the physical expanded memory page. The 
  12550.                    emsposition field is the current RAM disk file
  12551.                    position. totalpages is the total number of
  12552.                    expanded memory pages allocated for this EMS Ram file.
  12553.                    The rootblkptr points to the first EMS Block
  12554.                    pointer.
  12555.  
  12556.                    The minimumpages parameter specifies the initial
  12557.                    allocation, however if more pages are required, as you
  12558.                    write to the EMS Ram file, pages are automatically
  12559.  
  12560.  Programmer's Reference Guide       - 213 -         TEGL Windows Toolkit
  12561.  
  12562.  
  12563.  
  12564.  
  12565.  
  12566.                  Chapter 13 - Virtual Memory Manager
  12567.  
  12568.                    allocated as needed. Additional EMS handles and Pages
  12569.                    information are stored in separate EMS Block records
  12570.                    and are chained together.
  12571.  
  12572.                    ems_status will return a 0 if the EMS ram file is
  12573.                    allocated successfully; otherwise, it will return a
  12574.                    nonzero error code.
  12575. See also
  12576.                    emsclose
  12577.  
  12578.  
  12579.  
  12580. ___________________________________________________________________________
  12581.  
  12582. emsseek                                                                    
  12583. ___________________________________________________________________________
  12584.  
  12585.  
  12586. Function
  12587.                    Moves the current position of an EMS RAM file to a
  12588.                    specified byte component.
  12589. Syntax
  12590.                    void emsseek(emsfile emsramfile,unsigned long
  12591.                       position)
  12592. Remarks
  12593.                    emsramfile is the structure type returned by 
  12594.                    emsopen, and position is an expression of type
  12595.                    unsigned long.
  12596.                    The current EMS Ram file position is moved to the offset
  12597.                    position.  In order to expand the expanded memory
  12598.                    pages allocated, it is possible to emsseek any size
  12599.                    beyond the last byte; thus emsseek(myramfile, 98304)
  12600.                    will automatically allocate, if required, a total of 6
  12601.                    pages.
  12602.  
  12603.                    ems_status will return a 0 if the operation was
  12604.                    successful; otherwise, it will return a nonzero error
  12605.                    code.
  12606. Restrictions
  12607.                    EMS Ram file must be open.
  12608. See also
  12609.                    emsblockwrite, emsblockread, emsopen, emsclose
  12610.  
  12611.  
  12612.  
  12613. ___________________________________________________________________________
  12614.  
  12615. emsblockwrite                                                              
  12616. ___________________________________________________________________________
  12617.  
  12618.  
  12619.  Programmer's Reference Guide       - 214 -         TEGL Windows Toolkit
  12620.  
  12621.  
  12622.  
  12623.  
  12624.  
  12625.                  Chapter 13 - Virtual Memory Manager
  12626.  
  12627.  
  12628. Function
  12629.                    Writes the information pointed to by the Buffer pointer
  12630.                    to the EMS Ram file.
  12631. Syntax
  12632.                    void emsblockwrite(emsfile emsramfile,char
  12633.                       *buffer,unsigned long bytestowrite)
  12634. Remarks
  12635.                    emsramfile is the structure type returned by sh
  12636.                    EMSOpen, buffer is any char * type, and 
  12637.                    bytestowrite is an expression of type unsigned long.
  12638.  
  12639.                    emsblockwrite writes bytestowrite bytes to
  12640.                    the emsramfile. bytestowrite may be greater
  12641.                    than (64k). emsblockwrite will automatically
  12642.                    allocate additional EMS Memory pages if the current EMS
  12643.                    ram file position plus bytestowrite exceeds the
  12644.                    currently allocated expanded memory pages.
  12645.  
  12646.                    The current EMS Ram file position is advanced by 
  12647.                    bytestowrite on completion of emsblockwrite.
  12648.  
  12649.                    ems_status will return a 0 if the operation was
  12650.                    successful; otherwise, it will return a nonzero error
  12651.                    code.
  12652. Restrictions
  12653.                    EMS Ram file must be open.
  12654. See also
  12655.                    emsseek, emsblockread, emsopen, emsclose
  12656.  
  12657.  
  12658.  
  12659. ___________________________________________________________________________
  12660.  
  12661. emsblockread                                                               
  12662. ___________________________________________________________________________
  12663.  
  12664.  
  12665. Function
  12666.                    Reads from the EMS Ram file to memory pointed to by the
  12667.                    buffer pointer.
  12668. Syntax
  12669.                    void emsblockwrite(emsfile emsramfile,char
  12670.                        *buffer,unsigned long bytestowrite)
  12671. Remarks
  12672.                    emsramfile is the structuretype returned by sh
  12673.                    emsopen, buffer is any char * type, and 
  12674.                    bytestoread is an expression of type long.
  12675.  
  12676.                    emsblockread reads bytestoread bytes to the
  12677.  
  12678.  Programmer's Reference Guide       - 215 -         TEGL Windows Toolkit
  12679.  
  12680.  
  12681.  
  12682.  
  12683.  
  12684.                  Chapter 13 - Virtual Memory Manager
  12685.  
  12686.                    memory area pointed to by buffer. bytestoread
  12687.                    may be greater than (64k). emsblockread will read
  12688.                    past the end of Ram file and automatically allocate
  12689.                    additional EMS Memory pages if the current EMS Ram file
  12690.                    position plus bytestoread exceeds the currently
  12691.                    allocated expanded memory pages.
  12692.  
  12693.                    The current EMS Ram file position is advanced by 
  12694.                    bytestoread on completion of emsblockread.
  12695.  
  12696.                    ems_status will return a 0 if the operation was
  12697.                    successful; otherwise, it will return a nonzero error
  12698.                    code.
  12699. Restrictions
  12700.                    EMS Ram file must be open.
  12701. See also
  12702.                    emsblockwrite, emsseek, emsopen, emsclose
  12703.  
  12704.  
  12705.  
  12706. ___________________________________________________________________________
  12707.  
  12708. emsclose                                                                   
  12709. ___________________________________________________________________________
  12710.  
  12711.  
  12712. Function
  12713.                    Close an Open EMS Ram file.
  12714. Syntax
  12715.                    void emsclose(emsfile emsramfile)
  12716. Remarks
  12717.                    emsramfile is the structure type returned by sh
  12718.                    emsopen.
  12719.  
  12720.                    ems_status will return a 0 if the operation was
  12721.                    successful; otherwise, it will return a nonzero error
  12722.                    code.
  12723. See also
  12724.                    emsopen
  12725.  
  12726.  
  12727.  
  12728. Virtual Disk Heap
  12729.  
  12730. A virtual Disk Heap allows you to simulate a heap using a sequential file.
  12731. Allocating and freeing space within the Virtual Disk Heap are
  12732. automatically maintained, with all the flexibility of a real memory heap
  12733. manager and the unlimited space of a hard disk. The virtual Disk Heap
  12734. manager has the ability to reuse free space, as well as merging adjacent
  12735. free space fragments.
  12736.  
  12737.  Programmer's Reference Guide       - 216 -         TEGL Windows Toolkit
  12738.  
  12739.  
  12740.  
  12741.  
  12742.  
  12743.                  Chapter 13 - Virtual Memory Manager
  12744.  
  12745.  
  12746. In addition the virtual disk heap (disk mode) can be used as a simple
  12747. graphical image database manager. The stored images may be retrieved later
  12748. by referring to a unique signature that you provide.
  12749.  
  12750.  
  12751. ___________________________________________________________________________
  12752.  
  12753. vdskopenheapfile                                                           
  12754. ___________________________________________________________________________
  12755.  
  12756.  
  12757. Function
  12758.                    Opens a heap file on disk.
  12759. Syntax
  12760.                    vdskfile vdskopenheapfile(char
  12761.                       *vdskfilename,unsigned vdskattribute)
  12762. Result type
  12763.                    vdskopenheapfile returns a structure type 
  12764.                    vdskfile.
  12765. Remarks
  12766.                    vdskfilename is a char * expression that
  12767.                    contains the name of heap file and vdskattribute
  12768.                    is the attribute that is associated with the file. The
  12769.                    following vdskattribute enum are declared:
  12770.  
  12771.  
  12772. enum { vdskreadwrite = 1};
  12773. enum { vdsktemporary = 2};
  12774.  
  12775.  
  12776.                    vdskopenheapfile will create a new file if the
  12777.                    file does not exist. If vdskreadwrite is specified,
  12778.                    the file is not erased when the file is closed. if
  12779.                    vdskattribute is set to vdsktemporary, the file is
  12780.                    automatically erased when the file is closed.
  12781.  
  12782.                    vdskfile is declared as follows:
  12783.  
  12784.  
  12785. typedef struct vdskfreerecord *vdskfreeptr;
  12786. typedef struct vdskfreerecord {
  12787.         vdskfreeptr     nextvdskfree;
  12788.         unsigned long   startblock;
  12789.         unsigned long   endblock;
  12790.         signate         signature;
  12791.         char            blockfree;
  12792. }               vdskfreerecord;
  12793.  
  12794. typedef struct vdskfilerecord *vdskfile;
  12795.  
  12796.  Programmer's Reference Guide       - 217 -         TEGL Windows Toolkit
  12797.  
  12798.  
  12799.  
  12800.  
  12801.  
  12802.                  Chapter 13 - Virtual Memory Manager
  12803.  
  12804. typedef struct vdskfilerecord {
  12805.         vdskfreeptr     vdskfreeptrchain;
  12806.         unsigned long   vdsktopoffile;
  12807.         unsigned        vdskattribute;
  12808.         unsigned long   vdskpacketsave;
  12809.         char           *vdskfilename;
  12810.         char            emstype;/* Selector */
  12811.         union v {
  12812.                 int             vdskheapfile;
  12813.                 emsfile         vemsheapfile;
  12814.         }               v;
  12815. }               vdskfilerecord;
  12816.  
  12817.  
  12818.                    vdskfreeptrchain maintains a complete list of all
  12819.                    blocks that are allocated and freed.  Information
  12820.                    regarding each block are stored in a chain of 
  12821.                    vdskfreerecord.  The vdsktopoffile is the
  12822.                    position of the end of the heap file.  If there are no
  12823.                    free space fragments before the end of the heap file to
  12824.                    satisfy the requested block size, space is allocated
  12825.                    starting at vdsktopoffile.  vdskattribute is
  12826.                    the passed parameter when the file was opened.  The 
  12827.                    emstype sets the variant portion to either disk or ems
  12828.                    memory.
  12829.  
  12830.                    startblock and endblock is the starting and
  12831.                    ending address of the allocated or freed block,
  12832.                    respectively.  signature is a unique type of a 4
  12833.                    character string that can be used as a search string to
  12834.                    locate an address of a block.  blockfree indicates
  12835.                    whether the block is allocated or free.
  12836.  
  12837.                    vdskstatus will return a 0 if the operation was
  12838.                    successful; otherwise, it will return a nonzero error
  12839.                    code.
  12840. See also
  12841.                    vemsopenheapfile, vdskcloseheapfile
  12842.  
  12843.  
  12844.  
  12845.  
  12846. ___________________________________________________________________________
  12847.  
  12848. vemsopenheapfile                                                           
  12849. ___________________________________________________________________________
  12850.  
  12851.  
  12852. Function
  12853.                    Opens a heap file in EMS.
  12854.  
  12855.  Programmer's Reference Guide       - 218 -         TEGL Windows Toolkit
  12856.  
  12857.  
  12858.  
  12859.  
  12860.  
  12861.                  Chapter 13 - Virtual Memory Manager
  12862.  
  12863. Syntax
  12864.                    vdskfile vemsopenheapfile(int initialalloc)
  12865. Result type
  12866.                    vemsopenheapfile returns a variable of type 
  12867.                    vdskfile.
  12868. Remarks
  12869.                    vemsopenheapfile creates the same structure as 
  12870.                    vdskopenheapfile, with the emstype set to ems
  12871.                    memory.
  12872.  
  12873.                    vdskstatus will return a 0 if the ems operation was
  12874.                    successful; otherwise, it will return a nonzero error
  12875.                    code.
  12876. See also
  12877.                    vdskopenheapfile, vdskcloseheapfile
  12878.  
  12879.  
  12880.  
  12881.  
  12882. ___________________________________________________________________________
  12883.  
  12884. vdskgetmem                                                                 
  12885. ___________________________________________________________________________
  12886.  
  12887.  
  12888. Function
  12889.                    Allocates a block within the virtual heap memory and
  12890.                    returns a virtual heap address.
  12891. Syntax
  12892.                    unsigned long vdskgetmem(vdskfile
  12893.                      vdskpacket, unsigned long heapsize,char *signature)
  12894. Result type
  12895.                    vdskgetmem returns a virtual heap address of long.
  12896. Remarks
  12897.                    vdskstatus will return a 0 if the virtual heap
  12898.                    allocation was successfull; otherwise, it will return a
  12899.                    nonzero error code.
  12900. Restrictions
  12901.                    The Virtual Heap memory must be opened.
  12902. See also
  12903.                    vdskfreemem, vdskwriteheapdata, vdskreadheapdata
  12904.  
  12905.  
  12906.  
  12907.  
  12908. ___________________________________________________________________________
  12909.  
  12910. vdskfreemem                                                                
  12911. ___________________________________________________________________________
  12912.  
  12913.  
  12914.  Programmer's Reference Guide       - 219 -         TEGL Windows Toolkit
  12915.  
  12916.  
  12917.  
  12918.  
  12919.  
  12920.                  Chapter 13 - Virtual Memory Manager
  12921.  
  12922.  
  12923. Function
  12924.                    Frees the virtual heap memory pointed to by the 
  12925.                    VDskHeapPtr.
  12926. Syntax
  12927.                    void vdskfreemem(vdskfile vdskpacket,unsigned long
  12928.                       vdskheapptr)
  12929. Remarks
  12930.                    vdskpacket is the structure type returned by 
  12931.                    vemsopenheapfile or vdskopenheapfile. The 
  12932.                    vdskheapptr must be the virtual disk pointer from 
  12933.                    vdskgetmem.
  12934.  
  12935.                    vdskstatus will return a 0 if the virtual heap
  12936.                    de-allocation was successful; otherwise, it will return
  12937.                    a nonzero error code.
  12938. Restrictions
  12939.                    The Virtual Heap memory must be opened.
  12940. See also
  12941.                    vdskgetmem, vdskwriteheapdata, vdskreadheapdata
  12942.  
  12943.  
  12944.  
  12945. ___________________________________________________________________________
  12946.  
  12947. vdskwriteheapdata                                                          
  12948. ___________________________________________________________________________
  12949.  
  12950.  
  12951. Function
  12952.                    Writes the data from memory pointed to by the 
  12953.                    DataPtr to an allocated virtual heap memory 
  12954.                    vdskheapptr.
  12955. Syntax
  12956.                    void vdskwriteheapdata(vdskfile vdskpacket,char far
  12957.                       *dataptr,unsigned long vdskheapptr)
  12958. Remarks
  12959.                    vdskpacket is the structure type returned by 
  12960.                    vemsopenheapfile or vdskopenheapfile. The 
  12961.                    dataptr is of a pointer type that points to a memory
  12962.                    buffer that will be written out to the virtual heap.
  12963.                    The vdskheapptr must be the virtual heap pointer
  12964.                    created from vdskgetmem.
  12965.  
  12966.                    vdskstatus will return a 0 if writing to the virtual
  12967.                    heap was successful; otherwise, it will return a
  12968.                    nonzero error code.
  12969. Restrictions
  12970.                    The Virtual Heap memory must be opened.
  12971. See also
  12972.  
  12973.  Programmer's Reference Guide       - 220 -         TEGL Windows Toolkit
  12974.  
  12975.  
  12976.  
  12977.  
  12978.  
  12979.                  Chapter 13 - Virtual Memory Manager
  12980.  
  12981.                    vdskgetmem, vdskfreemem, vdskreadheapdata
  12982.  
  12983.  
  12984.  
  12985. ___________________________________________________________________________
  12986.  
  12987. vdskreadheapdata                                                           
  12988. ___________________________________________________________________________
  12989.  
  12990.  
  12991. Function
  12992.                    Reads the data from the virtual heap memory to a memory
  12993.                    area pointed to by the DataPtr.
  12994. Syntax
  12995.                    void vdskreadheapdata(vdskfile vdskpacket,char far
  12996.                      *dataptr,unsigned long vdskheapptr)
  12997. Remarks
  12998.                    vdskpacket is the structure type returned by 
  12999.                    vemsopenheapfile or vdskopenheapfile. The 
  13000.                    dataptr is of a pointer type that points to a memory
  13001.                    buffer that will be overwritten by the transfer of data
  13002.                    from the virtual heap. The vdskheapptr must be the
  13003.                    virtual heap pointer created from vdskgetmem.
  13004.  
  13005.                    vdskstatus will return a 0 if writing to the virtual
  13006.                    heap was successful; otherwise, it will return a
  13007.                    nonzero error code.
  13008. Restrictions
  13009.                    The Virtual Heap memory must be opened.
  13010. See also
  13011.                    vdskgetmem, vdskfreemem, vdskwriteheapdata
  13012.  
  13013.  
  13014.  
  13015.  
  13016. ___________________________________________________________________________
  13017.  
  13018. vdskcloseheapfile                                                          
  13019. ___________________________________________________________________________
  13020.  
  13021.  
  13022. Function
  13023.                    Closes a virtual heap.
  13024. Syntax
  13025.                    void vdskcloseheapfile(vdskfile vdskpacket)
  13026. Remarks
  13027.                    vdskpacket is the structure type returned by 
  13028.                    vemsopenheapfile or vdskopenheapfile.
  13029.  
  13030.                    vdskstatus will return a 0 if the virtual heap
  13031.  
  13032.  Programmer's Reference Guide       - 221 -         TEGL Windows Toolkit
  13033.  
  13034.  
  13035.  
  13036.  
  13037.  
  13038.                  Chapter 13 - Virtual Memory Manager
  13039.  
  13040.                    operation was successful; otherwise, it will return a
  13041.                    nonzero error code.
  13042. See also
  13043.                    vemsopenheapfile, vdskopenheapfile
  13044.  
  13045.  
  13046. The Virtual Heap Error Function
  13047.  
  13048. The vdskerror variable allows you to install a virtual heap error
  13049. function, which gets called whenever the TEGL heap manager cannot complete
  13050. an allocation request. vdskerror is a pointer that points to a
  13051. function with the following header:
  13052.  
  13053.  
  13054.  
  13055.     int myvirtualerr (unsigned long heapsize)
  13056.  
  13057.  
  13058.  
  13059. The virtual heap error function is installed by assigning its address to
  13060. the vdskerror variable:
  13061.  
  13062.  
  13063.  
  13064.     vdskerror = myvirtualerr;
  13065.  
  13066.  
  13067.  
  13068. The virtual heap error function gets called whenever any virtual function
  13069. calls is unable to complete the request. The code parameter contains
  13070. a code indicating which virtual heap function is in error. Check 
  13071. VDSKStatus to determine the severity of the error.
  13072.  
  13073. The standard virtual heap error function is set to return to the calling
  13074. procedure.
  13075.  
  13076. If you are using the Virtual memory manager (next section), use the
  13077. virtual memory error function rather then this error function to intercept
  13078. virtual errors. The virtual memory manager relies on the standard q
  13079. return to the calling procedure to check vdskstatus to indicate
  13080. whether to write to EMS or disk file.
  13081.  
  13082. The Virtual Memory Manager
  13083.  
  13084. The virtual memory manager is in constant use by TEGL windows to provide
  13085. memory extensions for graphical images. Your program may use the virtual
  13086. memory functions as an external heap, with the restriction that you do
  13087. close the virtual memory file.
  13088.  
  13089. The following virtual memory functions will automatically select the
  13090.  
  13091.  Programmer's Reference Guide       - 222 -         TEGL Windows Toolkit
  13092.  
  13093.  
  13094.  
  13095.  
  13096.  
  13097.                  Chapter 13 - Virtual Memory Manager
  13098.  
  13099. storage medium when moving data to virtual memory. The data is moved to
  13100. expanded memory if adequate space can be found, otherwise the data is
  13101. moved to one of the mass storage mediums. Both storage medium (EMS and
  13102. Hard disk) are used if available.
  13103.  
  13104.  
  13105.  
  13106. ___________________________________________________________________________
  13107.  
  13108. useharddisk                                                                
  13109. ___________________________________________________________________________
  13110.  
  13111.  
  13112. Function
  13113.                    This function forces the virtual memory manager to use
  13114.                    the hard disk as virtual memory, even if EMS is
  13115.                    available.
  13116. Syntax
  13117.                    Macro
  13118.                    void useharddisk(char yesno)
  13119. Remarks
  13120.                    if the yesno is 1, then the virtual memory
  13121.                    manager will ignore the installed EMS, and only use the
  13122.                    hard disk.
  13123.  
  13124.  
  13125.  
  13126. ___________________________________________________________________________
  13127.  
  13128. MoveFromVirtual procedure                                           VIRTMEM
  13129. ___________________________________________________________________________
  13130.  
  13131.  
  13132. Function
  13133.                    Moves a block of data from virtual back to normal
  13134.                    memory.
  13135. Syntax
  13136.                    void movefromvirtual(char far * dataptr,
  13137.                       unsigned long virtualheapptr)
  13138. Remarks
  13139.                    The dataptr is any memory block.  virtualheapptr
  13140.                    is of the type unsigned long, which is the address
  13141.                    supplied by movetovirtual.
  13142.  
  13143.                    vdskstatus will return a 0 if the virtual memory
  13144.                    operation was successful; otherwise, it will return a
  13145.                    nonzero error code.
  13146. See also
  13147.                    movetovirtual, freevirtual
  13148.  
  13149.  
  13150.  Programmer's Reference Guide       - 223 -         TEGL Windows Toolkit
  13151.  
  13152.  
  13153.  
  13154.  
  13155.  
  13156.                  Chapter 13 - Virtual Memory Manager
  13157.  
  13158.  
  13159.  
  13160. ___________________________________________________________________________
  13161.  
  13162. movetovirtual                                                              
  13163. ___________________________________________________________________________
  13164.  
  13165.  
  13166. Function
  13167.                    Moves a block of data from memory to virtual memory.
  13168. Syntax
  13169.                    unsigned long movetovirtual(char far
  13170.                       *dataptr,unsigned long heapsize)
  13171. Result type
  13172.                    movetovirtual returns a unsigned long type, which
  13173.                    is a physical address of the virtual block.
  13174. Remarks
  13175.                    The dataptr is any memory block allocated by 
  13176.                    cgetmem or fgetmem. heapsize is of the
  13177.                    type unsigned long, which is the size of the memory
  13178.                    block that you are moving to virtual memory.
  13179.  
  13180.                    movetovirtual will automatically allocate ems
  13181.                    memory pages and open any virtual memory files (if
  13182.                    needed) if this is the first time call to this
  13183.                    procedure.
  13184.  
  13185.                    vdskstatus will return a 0 if the virtual memory
  13186.                    operation was successful; otherwise, it will return a
  13187.                    nonzero error code.
  13188. See also
  13189.                    movefromvirtual, freevirtual
  13190.  
  13191.  
  13192.  
  13193. ___________________________________________________________________________
  13194.  
  13195. freevirtual                                                                
  13196. ___________________________________________________________________________
  13197.  
  13198.  
  13199. Function
  13200.                    Frees the virtual memory back to the virtual memory
  13201.                    pool for reuse.
  13202. Syntax
  13203.                    void freevirtual(unsigned long virtualheapptr)
  13204. Remarks
  13205.                    virtualheapptr is of the type unsigned long, which
  13206.                    is the address supplied by movetovirtual.
  13207.  
  13208.  
  13209.  Programmer's Reference Guide       - 224 -         TEGL Windows Toolkit
  13210.  
  13211.  
  13212.  
  13213.  
  13214.  
  13215.                  Chapter 13 - Virtual Memory Manager
  13216.  
  13217.                    vdskstatus will return a 0 if the virtual memory
  13218.                    operation was successful; otherwise, it will return a
  13219.                    nonzero error code.
  13220. See also
  13221.                    movetovirtual, movefromvirtual
  13222.  
  13223.  
  13224.  
  13225.  
  13226. ___________________________________________________________________________
  13227.  
  13228. cmaxavail                                                                  
  13229. ___________________________________________________________________________
  13230.  
  13231.  
  13232. Function
  13233.                    Returns the size of the largest block available in the
  13234.                    upper heap.
  13235. Syntax
  13236.                    unsigned long cmaxavail(void)
  13237.  
  13238.  
  13239.  
  13240. ___________________________________________________________________________
  13241.  
  13242. virtualmemused                                                             
  13243. ___________________________________________________________________________
  13244.  
  13245.  
  13246. Function
  13247.                    Returns the amount of virtual memory allocated.
  13248. Syntax
  13249.                    unsigned long virtualmemused(void)
  13250. Remarks
  13251.                    This is the total of virual memory allocated. On some
  13252.                    systems this can be a combination of both EMS and
  13253.                    Disk memory.
  13254.  
  13255.  
  13256. The Virtual Memory Error Function
  13257. The virtualerror variable allows you to install a virtual memory
  13258. error function, which gets called whenever the virtual memory manager
  13259. cannot complete a virtual function request. virtualerror is a pointer
  13260. that points to a function with the following header:
  13261.  
  13262.  
  13263.  
  13264.     int myvirtmemerr (unsigned code)
  13265.  
  13266.  
  13267.  
  13268.  Programmer's Reference Guide       - 225 -         TEGL Windows Toolkit
  13269.  
  13270.  
  13271.  
  13272.  
  13273.  
  13274.                  Chapter 13 - Virtual Memory Manager
  13275.  
  13276.  
  13277. The virtual memory error function is installed by assigning its address to
  13278. the VirtualError variable:
  13279.  
  13280.  
  13281.  
  13282.     vdskerror := myvirtmemerr;
  13283.  
  13284.  
  13285.  
  13286. The virtual memory error function gets called whenever any virtual
  13287. function calls is unable to complete the request. The code parameter
  13288. contains a code indicating which virtual heap function is in error. Check
  13289. vdskstatus to determine the severity of the error.
  13290.  
  13291. The standard virtual memory error function is set to return to the calling
  13292. function.
  13293.  
  13294.  
  13295. Resolving Fragments
  13296. The memory used by the heap is a dynamic and volatile part of your program.
  13297. Memory is constantly allocated and de-allocated by the window manager along
  13298. with allocation of dynamic variables, free space structures, frame
  13299. structures, mouse click structures, etc.
  13300.  
  13301. Although the virtual memory manager will provide almost unlimited windows,
  13302. the concept is still limited by the number of window structures that will
  13303. fit in memory and whether the memory is contiguous or fragmented by
  13304. allocated memory not under the control of the virtual memory manager.
  13305.  
  13306. Fragmentation occurs, when free memory blocks are separated by allocated
  13307. blocks. Since certain allocated memory blocks cannot be moved or
  13308. de-allocated, fragmentation can cut down the largest block size available
  13309. from the heap.
  13310.  
  13311. Without a proper control on memory fragmentation, an out of space error
  13312. can still occur even when the virtual memory manager pages out all window
  13313. images.
  13314.  
  13315. In order for the virtual memory Manager to provide large contiguous memory
  13316. on the heap, two memory managers are used to partition the far heap memory.
  13317. The normal Turbo C heap manager is replaced with cgetmem to allocate
  13318. simple memory blocks like frame information and virtual pointer
  13319. information.  The second, is fgetmem, used by the window manager to
  13320. allocated large image buffers.
  13321.  
  13322. The function ReserveHugeMinimum partitions the far heap memory into
  13323. two parts by allocating a single byte between the minimum and upper memory.
  13324. Normal allocations using cgetmem will default to the lower areas.  
  13325. cgetmem will use the upper area when all lower memory area is used, thus
  13326.  
  13327.  Programmer's Reference Guide       - 226 -         TEGL Windows Toolkit
  13328.  
  13329.  
  13330.  
  13331.  
  13332.  
  13333.                  Chapter 13 - Virtual Memory Manager
  13334.  
  13335. the lower memory area is not a restriction.  fgetmem will only
  13336. allocate memory from the upper areas.
  13337.  
  13338. ReserveHugeMinimum provides an elegant solution, that allows normal
  13339. allocation with cgetmem and volatile fgetmem to coexist.
  13340.  
  13341.  
  13342. ___________________________________________________________________________
  13343.  
  13344. reservehugeminimum                                                         
  13345. ___________________________________________________________________________
  13346.  
  13347.  
  13348. Function
  13349.                    Partition the heap memory into lower and upper areas to
  13350.                    reduce fragmentation.
  13351. Syntax
  13352.                    Macro
  13353.                    void reservehugeminimum(unsigned long minsize)
  13354. Remarks
  13355.                    minimumsize is of the type unsigned long, which is the
  13356.                    size calculated by adding (60 bytes for a window structure) +
  13357.                    the average mouse click and key clicks areas per
  13358.                    window (20 bytes per each defined click) multiplied by the
  13359.                    maximum number of window records opened at the same time +
  13360.                    4000 bytes (overhead for the virtual memory manager) plus any
  13361.                    heap memory requirements by the application.
  13362.  
  13363.                    You are not expected to calculate the exact minimumsize,
  13364.                    but as a general rule of thumb, it seems that 12k is
  13365.                    effective for most applications.
  13366.  
  13367.  
  13368.  
  13369.  
  13370.  
  13371.  
  13372.  
  13373.  
  13374.  
  13375.  
  13376.  
  13377.  
  13378.  
  13379.  
  13380.  
  13381.  
  13382.  
  13383.  
  13384.  
  13385.  
  13386.  Programmer's Reference Guide       - 227 -         TEGL Windows Toolkit
  13387.  
  13388.  
  13389.  
  13390.  
  13391.  
  13392.                        Chapter 14 - Sizing and Sliders
  13393.  
  13394. Sizing and Sliding
  13395.  
  13396. The chapter has the procedures and functions that give the core for
  13397. resizing frames and attachings sliders to them.
  13398.  
  13399. A slider is a moveable switch. They are quite often used to indicate up
  13400. and down or left to right scrolls (as in a text editor). They can be
  13401. attached to a window but are seperate, that is, they must be disposed of
  13402. seperately.
  13403.  
  13404. Resizing frames adds a degree of complexity to maintaining frames in that
  13405. the contents of the frame are lost when it is resized. Consequently, you
  13406. need to code an event that specifically redraws a frame after resizing.
  13407.  
  13408. Resizable frames with slider bars require more work. It is up to the
  13409. programmer to dispose of and then reattach new sliders to a frame after
  13410. a resize. This presumably is all done within the event that redraws the
  13411. window. This is not impossible, just careful thought is required when
  13412. making these kinds of frames. The results will speak for themselves.
  13413.  
  13414.  
  13415. ___________________________________________________________________________
  13416.  
  13417. defineresizeclickarea                                                      
  13418. ___________________________________________________________________________
  13419.  
  13420.  
  13421. Function
  13422.                    Sets a mouse click area for resizing a frame.
  13423. Declaration
  13424.                    void defineresizeclickarea(imagestkptr ifs,
  13425.                      unsigned x, unsigned y, unsigned x1, unsigned y1,
  13426.                        callproc resizeproc);  
  13427. Remarks
  13428.                    The resizeproc must be defined. You cannot pass a
  13429.                    NULL pointer. When a frame is resized its image is
  13430.                    disposed and must be redrawn.
  13431.  
  13432. See also
  13433.                    defineresizeminmax.
  13434. Example
  13435.  
  13436.  
  13437.   defineresizeclickarea(ifs,1,1,10,6,redraweditor);
  13438.  
  13439.  
  13440.  
  13441.  
  13442.  
  13443.  
  13444.  
  13445.  Programmer's Reference Guide       - 228 -         TEGL Windows Toolkit
  13446.  
  13447.  
  13448.  
  13449.  
  13450.  
  13451.                        Chapter 14 - Sizing and Sliders
  13452.  
  13453. ___________________________________________________________________________
  13454.  
  13455. defineresizeminmax                                                         
  13456. ___________________________________________________________________________
  13457.  
  13458.  
  13459.  
  13460. Function
  13461.                    Sets the minimum and maximum that a frame can be
  13462.                    resized to.
  13463. Declaration
  13464.                    void defineresizeminmax(imagestkptr ifs,
  13465.                      unsigned minw, unsigned minh, unsigned maxw,
  13466.                        unsigned maxh); 
  13467. Remarks
  13468.                    minw is the minimum width the frame is allowed if
  13469.                    resized. minh is the minimum height, maxw is the
  13470.                    maximum width, and maxh is maximum height. Values
  13471.                    are in pixels.
  13472. See also
  13473.                    defineresizeclickarea.
  13474. Example
  13475.  
  13476.  
  13477.   defineresizeminmax(ifs,200,100,400,200);
  13478.  
  13479.  
  13480.  
  13481.  
  13482.  
  13483. ___________________________________________________________________________
  13484.  
  13485. definesliderarea                                                           
  13486. ___________________________________________________________________________
  13487.  
  13488.  
  13489. Function
  13490.                    Defines slider area.
  13491. Declaration
  13492.                    void definesliderarea(imagestkptr ifs, unsigned x,
  13493.                      unsigned y, unsigned x1, unsigned y1, unsigned minx,
  13494.                        unsigned miny, unsigned maxx, unsigned maxy,
  13495.                          callproc slideaction); 
  13496. Remarks
  13497.                    ifs is the frame the slider is attached to. x,y,
  13498.                    x1, y1 is the slider click area. minx, miny, maxx, maxy
  13499.                    are the bounds the slider can be moved in. Coordinates
  13500.                    are frame relative. slideaction is the event that is
  13501.                    called when the slider is moved.
  13502.  
  13503.  
  13504.  Programmer's Reference Guide       - 229 -         TEGL Windows Toolkit
  13505.  
  13506.  
  13507.  
  13508.  
  13509.  
  13510.                        Chapter 14 - Sizing and Sliders
  13511.  
  13512.                    The msclickptr that is passed to slideaction contains
  13513.                    the new slider position. These coordinates can be used to
  13514.                    determine the correct action to taken.
  13515. Restrictions
  13516.                    This procedure only sets the area for the slider and its
  13517.                    bounds. It is up to the programmer to draw the slider bar
  13518.                    and the slider. The slider bar must be drawn before the
  13519.                    call to definesliderarea. Then after this draw the
  13520.                    slider. The toolkit will look after moving the slider
  13521.                    once it has been drawn.
  13522. See also
  13523.                    setslidepostion
  13524. Example
  13525.  
  13526.  
  13527.  
  13528.  
  13529.  
  13530.  
  13531.  
  13532. ___________________________________________________________________________
  13533.  
  13534. dropsliders                                                                
  13535. ___________________________________________________________________________
  13536.  
  13537.  
  13538. Function
  13539.                    Removes all sliders from a frame.
  13540. Declaration
  13541.                    void dropsliders(imagestkptr ifs); 
  13542. Remarks
  13543.                    dropsliders should be called before you drop a
  13544.                    frame or resize it.
  13545. Restrictions
  13546. See also
  13547. Example
  13548.  
  13549.  
  13550.   dropsliders(ifs);
  13551.  
  13552.  
  13553.  
  13554.  
  13555.  
  13556.  
  13557. ___________________________________________________________________________
  13558.  
  13559. findsliderfs                                                               
  13560. ___________________________________________________________________________
  13561.  
  13562.  
  13563.  Programmer's Reference Guide       - 230 -         TEGL Windows Toolkit
  13564.  
  13565.  
  13566.  
  13567.  
  13568.  
  13569.                        Chapter 14 - Sizing and Sliders
  13570.  
  13571.  
  13572. Function
  13573.                    Finds a slider on a frame.
  13574. Declaration
  13575.                    sliderptr findsliderfs(imagestackptr ifs,
  13576.                      msclickptr ms); 
  13577. Remarks
  13578.                    Returns the sliderptr associated with ms on the
  13579.                    frame. This can be used from within an event that is
  13580.                    called when a slider is moved. With the SliderPtr
  13581.                    you can determine the relative position of the slider
  13582.                    without having to examine any other variables.
  13583. Restrictions
  13584. See also
  13585. Example
  13586.  
  13587.  
  13588.  
  13589.  
  13590.  
  13591.  
  13592.  
  13593. ___________________________________________________________________________
  13594.  
  13595. resizeframe                                                                
  13596. ___________________________________________________________________________
  13597.  
  13598.  
  13599. Function
  13600.                    Allocates a new buffer for a frame.
  13601. Declaration
  13602.                    void resizeframe(imagestkptr ifs,
  13603.                      unsigned x, unsigned y, unsigned x1, unsigned y1);
  13604. Remarks
  13605.                    x, y, x1, y1 are the new coordinates of the frame.
  13606. Restrictions
  13607.                    The frame image is hidden then disposed.
  13608. See also
  13609.                    defineresizeminmax
  13610. Example
  13611.  
  13612.  
  13613.  
  13614.  
  13615.  
  13616.  
  13617.  
  13618.  
  13619. ___________________________________________________________________________
  13620.  
  13621.  
  13622.  Programmer's Reference Guide       - 231 -         TEGL Windows Toolkit
  13623.  
  13624.  
  13625.  
  13626.  
  13627.  
  13628.                        Chapter 14 - Sizing and Sliders
  13629.  
  13630. selectandmoveframe                                                         
  13631. ___________________________________________________________________________
  13632.  
  13633.  
  13634. Function
  13635.                    An event that allows the frame to be moved.
  13636. Declaration
  13637.                    unsigned selectandmoveframe(imagestkptr ifs,
  13638.                      msclickptr ms);
  13639. Remarks
  13640.                    Note that this is an event. You would not directly call
  13641.                    it but rather would pass it with a definemouseclickarea.
  13642. See also
  13643.                    definemouseclickarea.
  13644. Example
  13645.  
  13646.  
  13647.   /* the top 10 pixels across the frame ifs is set to SelectAndMoveFrame */
  13648.  
  13649.   definemouseclickarea(ifs,0,0,ifs->x1,10,TRUE,
  13650.     selectandmoveframe,MSCLICK);
  13651.  
  13652.  
  13653.  
  13654.  
  13655.  
  13656. ___________________________________________________________________________
  13657.  
  13658. setslideposition                                                           
  13659. ___________________________________________________________________________
  13660.  
  13661.  
  13662.  
  13663. Function
  13664.                    Moves a slider to a new position.
  13665. Declaration
  13666.                    void setslideposition(imagestkpointer ifs,
  13667.                      unsigned x, unsigned y);
  13668. Remarks
  13669.                    x,y are relative coordinates within the frame and
  13670.                    must be within the slider bar.
  13671. See also
  13672.                    definesliderarea.
  13673.  
  13674.  
  13675.  
  13676.  
  13677.  
  13678.  
  13679.  
  13680.  
  13681.  Programmer's Reference Guide       - 232 -         TEGL Windows Toolkit
  13682.  
  13683.  
  13684.  
  13685.  
  13686.  
  13687.                            Miscellaneous Functions
  13688.  
  13689. Miscellaneous Functions
  13690. ___________________________________________________________________________
  13691.  
  13692.  
  13693. ___________________________________________________________________________
  13694.  
  13695. checkctrlbreak                                                             
  13696. ___________________________________________________________________________
  13697.  
  13698.  
  13699.  
  13700. Function
  13701.                    Checks task handler.
  13702. Syntax
  13703.                    void checkctrlbreak(void); 
  13704. Remarks
  13705.                    Normally this routine does not have to be called, but
  13706.                    if you have section of code that is going through a
  13707.                    long loop you should insert it there.
  13708.  
  13709.                    If your program has events that are activated after a
  13710.                    certain number of timer ticks have passed then a call
  13711.                    to checkctrlbreak will allow their processing.
  13712.  
  13713.                    The TEGL Windows Toolkit does not process timer
  13714.                    interrupt tasks directly, rather a flag is set and
  13715.                    the task is performed when it is safe (ie. no frames
  13716.                    are being updated and no memory swaps are begin
  13717.                    processed).
  13718. Example
  13719.  
  13720.  
  13721.  
  13722.   long  x;
  13723.  
  13724.   for (x = 1;x < 20000000; x++)
  13725.     
  13726.       /* do your stuff */
  13727.       checkctrlbreak();   /* allow processing of other tasks */
  13728.     
  13729.  
  13730.  
  13731.  
  13732.  
  13733.  
  13734. ___________________________________________________________________________
  13735.  
  13736. checkctrlbreakfs                                                           
  13737. ___________________________________________________________________________
  13738.  
  13739.  
  13740.  Programmer's Reference Guide       - 233 -         TEGL Windows Toolkit
  13741.  
  13742.  
  13743.  
  13744.  
  13745.  
  13746.                            Miscellaneous Functions
  13747.  
  13748.  
  13749.  
  13750. Function
  13751.                    Sets an event to call when Ctrl-Break is pressed.
  13752. Syntax
  13753.                    Macro
  13754.                    void checkctrlbreakfs(callproc p); 
  13755. Remarks
  13756.                    P is an event and works like any other. You can
  13757.                    determine within it what processing should take place
  13758.                    (Halt, Continue, Close files, etc..).
  13759. Example
  13760.                    see inittegl in tegleasy.
  13761.  
  13762.  
  13763.  
  13764. ___________________________________________________________________________
  13765.  
  13766. droptimertick                                                              
  13767. ___________________________________________________________________________
  13768.  
  13769.  
  13770.  
  13771. Function
  13772.                    Removes an event set with SetTimerTick.
  13773. Syntax
  13774.                    void droptimertick(unsigned ticks, callproc p); 
  13775. Remarks
  13776.                    both ticks and p must be identical to the
  13777.                    orginal call for the event to be removed.
  13778. See also
  13779.                    settimertick.
  13780. Example
  13781.  
  13782.  
  13783.   droptimertick(18,backgroundclock);
  13784.  
  13785.  
  13786.  
  13787.  
  13788.  
  13789.  
  13790. ___________________________________________________________________________
  13791.  
  13792. nilunitproc                                                                
  13793. ___________________________________________________________________________
  13794.  
  13795.  
  13796.  
  13797. Function
  13798.  
  13799.  Programmer's Reference Guide       - 234 -         TEGL Windows Toolkit
  13800.  
  13801.  
  13802.  
  13803.  
  13804.  
  13805.                            Miscellaneous Functions
  13806.  
  13807.                    A place holder for events that have not been coded.
  13808. Syntax
  13809.                    unsigned nilunitproc(imagestkptr ifs, msclickptr ms); 
  13810. Remarks
  13811.                    nilunitproc can be used wherever an event handler
  13812.                    is called for. This can be a place holder or it can be
  13813.                    where event is desired but a parameter is required.
  13814. Example
  13815.  
  13816.  
  13817.   { -- a line in a menu that is never selected or active }
  13818.   defineoptions(filem,'--',FALSE,nilunitproc);
  13819.  
  13820.  
  13821.  
  13822.  
  13823.  
  13824. ___________________________________________________________________________
  13825.  
  13826. overlaparea                                                                
  13827. ___________________________________________________________________________
  13828.  
  13829.  
  13830.  
  13831. Function
  13832.                    Returns the area that is occupied by two sets of
  13833.                    coordinates.
  13834. Syntax
  13835.                    char overlaparea(unsigned ax, unsigned ay, unsigned ax1,
  13836.                      unsigned ay1, unsigned bx, unsigned by, unsigned bx1,
  13837.                        unsigned by1, unsigned *cx, unsigned *cy,
  13838.                          unsigned *cx1, unsigned *cy1);
  13839. Remarks
  13840.                    a and b coodinates are the areas to test.
  13841.                    If they overlap then the area is return in the c
  13842.                    coordinates and the function returns true, otherwise
  13843.                    the function returns false and the c coordinates
  13844.                    are undetermined.
  13845.  
  13846.                    This is an advanced function that normally would not
  13847.                    be used.
  13848.  
  13849.  
  13850.  
  13851. ___________________________________________________________________________
  13852.  
  13853. settimertick                                                               
  13854. ___________________________________________________________________________
  13855.  
  13856.  
  13857.  
  13858.  Programmer's Reference Guide       - 235 -         TEGL Windows Toolkit
  13859.  
  13860.  
  13861.  
  13862.  
  13863.  
  13864.                            Miscellaneous Functions
  13865.  
  13866.  
  13867. Function
  13868.                    Sets an event to be called periodically.
  13869. Syntax
  13870.                    void settimertick(unsigned ticks, callproc p,
  13871.                      imagestkptr ifs, msclickptr ms); 
  13872. Remarks
  13873.                    Ticks is how many timer ticks to wait before
  13874.                    begin called. p is the event to call. ifs and
  13875.                    ms are passed to p.
  13876. See also
  13877.                    droptimertick.
  13878. Example
  13879.  
  13880.  
  13881.   settimertick(18,backgroundclock,NULL,NULL);
  13882.  
  13883.  
  13884.  
  13885.  
  13886.  
  13887.  
  13888.  
  13889.  
  13890.  
  13891.  
  13892.  
  13893.  
  13894.  
  13895.  
  13896.  
  13897.  
  13898.  
  13899.  
  13900.  
  13901.  
  13902.  
  13903.  
  13904.  
  13905.  
  13906.  
  13907.  
  13908.  
  13909.  
  13910.  
  13911.  
  13912.  
  13913.  
  13914.  
  13915.  
  13916.  
  13917.  Programmer's Reference Guide       - 236 -         TEGL Windows Toolkit
  13918.  
  13919.  
  13920.  
  13921.  
  13922.  
  13923.                         Graphics Library - tgraph
  13924.  
  13925. TGraph
  13926. ___________________________________________________________________________
  13927.  
  13928. The tgraph module provides a subset of the functions in the
  13929. graphics.lib unit provided with Turbo C.
  13930.  
  13931. tgraph does not have to be used if you are using Turbo C. If your
  13932. program requires elaborate graphics drawing and painting then graphics.lib
  13933. is needed. If, however, your graphics need are simpler then tgraph
  13934. may provide all that is needed. If this is the case your program can be as
  13935. much as 25K smaller by using tgraph exculsively. See the appendix 
  13936. Conditional Compilation for directions on building the toolkit without
  13937. using graphics.lib.
  13938.  
  13939. If you are programming with Microsoft's C or Quick C then tgraph is
  13940. necessary. Depending on the defines in the file teglcond.h (see the
  13941. appendix Conditional Compilation) tgraph acts as stand-alone or maps
  13942. graphics calls to the equivalent routine in graphics.lib.
  13943.  
  13944. Both Turbo C and Microsoft C's provide the file (it graphics.lib but they
  13945. are not compatible. TEGL Windows Toolkit tgraph module uses the naming
  13946. conventions for graphics.lib in Turbo C.
  13947.  
  13948. When using Turbo C and tgraph be sure NOT to specify the graphics library
  13949. option in the integrated environment. For the command line compiler do not
  13950. include graphics.lib in the link list.
  13951.  
  13952.  
  13953. ___________________________________________________________________________
  13954.  
  13955. Bar                                                                        
  13956. ___________________________________________________________________________
  13957.  
  13958.  
  13959. Function
  13960.                    Draws a bar using the current fill style and color.
  13961. Syntax
  13962.                    Bar(x1, y1, x2, y2: Integer);
  13963. Remarks
  13964.                    Draws a filled in bar using the pattern and color
  13965.                    defined by SetFillStyle or SetFillPattern.
  13966. See also
  13967.                    SetFillStyle, SetFillPattern
  13968.  
  13969.  
  13970.  
  13971. ___________________________________________________________________________
  13972.  
  13973. closegraph                                                                 
  13974. ___________________________________________________________________________
  13975.  
  13976.  Programmer's Reference Guide       - 237 -         TEGL Windows Toolkit
  13977.  
  13978.  
  13979.  
  13980.  
  13981.  
  13982.                         Graphics Library - tgraph
  13983.  
  13984.  
  13985.  
  13986. Function
  13987.                    Shuts down the graphics system.
  13988. Syntax
  13989.                    closegraph;
  13990. Remarks
  13991.                    The screen mode is restored to the original mode before
  13992.                    graphics were initialized.
  13993.  
  13994.  
  13995.  
  13996. ___________________________________________________________________________
  13997.  
  13998. detectgraph                                                                
  13999. ___________________________________________________________________________
  14000.  
  14001.  
  14002. Function
  14003.                    Detects graphics hardware.
  14004. Syntax
  14005.                    void far detectgraph(int far *graphdriver,
  14006.                                         int far graphmode);
  14007. Remarks
  14008.                    Returns the detected driver and mode value that can be
  14009.                    passed to initgraph which will change to graphics
  14010.                    mode. If no graphics hardware is found or the graphics
  14011.                    hardware is not supported  then a call to graphresult
  14012.                    will return a value of -2 (grNotDetected).
  14013. See also
  14014.                    initgraph, graphresult
  14015.  
  14016.  
  14017.  
  14018. ___________________________________________________________________________
  14019.  
  14020. getbkcolor                                                                 
  14021. ___________________________________________________________________________
  14022.  
  14023.  
  14024. Function
  14025.                    Returns the current background color.
  14026. Syntax
  14027.                    int far getbkcolor(void);
  14028. Remarks
  14029.                    Background colors can range from 0 to 15.
  14030. See also
  14031.                    getcolor, setbkcolor, setcolor
  14032.  
  14033.  
  14034.  
  14035.  Programmer's Reference Guide       - 238 -         TEGL Windows Toolkit
  14036.  
  14037.  
  14038.  
  14039.  
  14040.  
  14041.                         Graphics Library - tgraph
  14042.  
  14043.  
  14044. ___________________________________________________________________________
  14045.  
  14046. getcolor                                                                   
  14047. ___________________________________________________________________________
  14048.  
  14049.  
  14050. Function
  14051.                    Returns the color value passed to the previous call to
  14052.                    setcolor.
  14053. Syntax
  14054.                    int far getcolor(void);
  14055. Remarks
  14056.                    Drawing colors can range from 0 to 15.
  14057. See also
  14058.                    setcolor
  14059.  
  14060.  
  14061.  
  14062. ___________________________________________________________________________
  14063.  
  14064. getfillpattern                                                             
  14065. ___________________________________________________________________________
  14066.  
  14067.  
  14068. Function
  14069.                    Returns the last fill pattern set by the last call to
  14070.                    setfillpattern.
  14071. Syntax
  14072.                    void far getfillpattern(char far *pattern);
  14073. Remarks
  14074.                    Copies the user-defined fill pattern set by
  14075.                    setfillpattern into the area pointed to by
  14076.                    pattern. It must be an area of 8 bytes.
  14077.  
  14078.                    The following pattern definition would create a
  14079.                    solid fill.
  14080.  
  14081.                    char solid[8] =
  14082.                      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff;
  14083.  
  14084. See also
  14085.                    setfillpattern, getfillsettings
  14086.  
  14087.  
  14088.  
  14089. ___________________________________________________________________________
  14090.  
  14091. getgraphmode                                                               
  14092. ___________________________________________________________________________
  14093.  
  14094.  Programmer's Reference Guide       - 239 -         TEGL Windows Toolkit
  14095.  
  14096.  
  14097.  
  14098.  
  14099.  
  14100.                         Graphics Library - tgraph
  14101.  
  14102.  
  14103.  
  14104. Function
  14105.                    Returns the current graphics mode.
  14106. Syntax
  14107.                    int far getgraphmode(void);
  14108. Remarks
  14109.                    Returns the current graphics mode set by initgraph
  14110.                    or setgraphmode.
  14111. See also
  14112.                    detectgraph, initgraph, restorecrtmode,
  14113.                      setgraphmode
  14114.  
  14115.  
  14116.  
  14117. ___________________________________________________________________________
  14118.  
  14119. getmaxx                                                                    
  14120. ___________________________________________________________________________
  14121.  
  14122.  
  14123. Function
  14124.                    Returns the pixel width (minus 1) of the current graphics
  14125.                    driver and mode.
  14126. Syntax
  14127.                    int far getmaxx(void);
  14128. Remarks
  14129.                    getmaxx can be used to determine the boundaries of the
  14130.                    screen.
  14131. See also
  14132.                    getmaxy, getx, gety
  14133.  
  14134.  
  14135.  
  14136. ___________________________________________________________________________
  14137.  
  14138. getmaxy                                                                    
  14139. ___________________________________________________________________________
  14140.  
  14141.  
  14142. Function        Returns the pixel height (minus 1) of the current graphics
  14143.                    driver and mode.
  14144. Syntax
  14145.                    int far getmaxy(void);
  14146. Remarks
  14147.                    getmaxy can be used to determine the boundaries of the
  14148.                    screen.
  14149. See also
  14150.                    getmaxx, getx, gety
  14151.  
  14152.  
  14153.  Programmer's Reference Guide       - 240 -         TEGL Windows Toolkit
  14154.  
  14155.  
  14156.  
  14157.  
  14158.  
  14159.                         Graphics Library - tgraph
  14160.  
  14161.  
  14162.  
  14163. ___________________________________________________________________________
  14164.  
  14165. gettextsettings                                                            
  14166. ___________________________________________________________________________
  14167.  
  14168.  
  14169. Function
  14170.                    Returns the current text settings.
  14171. Syntax
  14172.                    void far gettextsettings(struct textsettingstype
  14173.                      far *textinfo);
  14174. Remarks
  14175.                    textsettingstype contains fields for the font,
  14176.                    direction, size and justification that was set by
  14177.                    settextstyle and settextjustify.
  14178. See also
  14179.                    settextjustify, settextstyle
  14180.  
  14181.  
  14182.  
  14183. ___________________________________________________________________________
  14184.  
  14185. graphresult                                                                
  14186. ___________________________________________________________________________
  14187.  
  14188.  
  14189. Function
  14190.                    Returns the error code for the last graphics operation.
  14191. Syntax
  14192.                    int far graphresult(void);
  14193. Remarks
  14194.                    graphresult is reset to zero after it has been
  14195.                    called. The user may want to store it into a temporary
  14196.                    variable before testing it.
  14197.  
  14198.  
  14199.  
  14200. ___________________________________________________________________________
  14201.  
  14202. imagesize                                                                  
  14203. ___________________________________________________________________________
  14204.  
  14205.  
  14206. Function
  14207.                    Returns the number of bytes required to store a
  14208.                    rectangular region of the screen.
  14209. Syntax
  14210.                    unsigned far imagesize(int x1, int y1, int x2, int y2);
  14211.  
  14212.  Programmer's Reference Guide       - 241 -         TEGL Windows Toolkit
  14213.  
  14214.  
  14215.  
  14216.  
  14217.  
  14218.                         Graphics Library - tgraph
  14219.  
  14220. Remarks
  14221.                    x1,y1,x2,y1 defines the area on the screen.
  14222.  
  14223.  
  14224.  
  14225. ___________________________________________________________________________
  14226.  
  14227. initgraph                                                                  
  14228. ___________________________________________________________________________
  14229.  
  14230.  
  14231. Function
  14232.                    Initializes the graphics system and sets the hardware to
  14233.                    graphics mode.
  14234. Syntax
  14235.                    void far initgraph(int far *graphdrive,
  14236.                       int far *graphmode, char far *driverpath);
  14237. Remarks
  14238.                    If graphdriver is equal to 0 (DETECT) then a
  14239.                    call is made to detectgraph. If supported hardware
  14240.                    is detected then the graphics system is initialized and
  14241.                    a graphics mode is selected.
  14242.  
  14243.                    The parameter driverpath is provided for compatibility
  14244.                    with graphics.lib, it is not used, all drivers are
  14245.                    linked in.
  14246.  
  14247.                    If you are using one of the Microsoft C compilers and a
  14248.                    hurcules display then the program MSHerc.com must be run
  14249.                    first.
  14250. See also
  14251.                    detectgraph, closegraph
  14252.  
  14253.  
  14254.  
  14255. ___________________________________________________________________________
  14256.  
  14257. line                                                                       
  14258. ___________________________________________________________________________
  14259.  
  14260.  
  14261. Function
  14262.                    Draws a line from x1, y1 to x2, y2.
  14263. Syntax
  14264.                    void far line(int x1, int y1, int x2, int y2);
  14265. Remarks
  14266.                    Draws a line in the color set by setcolor
  14267.  
  14268.  
  14269.  
  14270.  
  14271.  Programmer's Reference Guide       - 242 -         TEGL Windows Toolkit
  14272.  
  14273.  
  14274.  
  14275.  
  14276.  
  14277.                         Graphics Library - tgraph
  14278.  
  14279. ___________________________________________________________________________
  14280.  
  14281. outtextxy                                                                  
  14282. ___________________________________________________________________________
  14283.  
  14284.  
  14285. Function
  14286.                    Sends a string to the screen.
  14287. Syntax
  14288.                    void far outtextxy(int x, int y, char far* textstring);
  14289. Remarks
  14290.                    textstring is output at the screen location
  14291.                    x,y.
  14292.  
  14293.                    outtextxy uses the options set by settextjustify.
  14294. See also
  14295.                    settextjustify, gettextsettings
  14296.  
  14297.  
  14298.  
  14299. ___________________________________________________________________________
  14300.  
  14301. rectangle                                                                  
  14302. ___________________________________________________________________________
  14303.  
  14304.  
  14305. Function
  14306.                    Draws a rectangle using the current color.
  14307. Syntax
  14308.                    void far rectangle(int x1, int y1, int x2, int y2);
  14309. Remarks
  14310.                    x1,y1 define the upper left corner of the rectangle,
  14311.                    and x2,y2 define the lower right corner.
  14312. See also
  14313.                    setcolor
  14314.  
  14315.  
  14316.  
  14317. ___________________________________________________________________________
  14318.  
  14319. restorecrtmode                                                             
  14320. ___________________________________________________________________________
  14321.  
  14322.  
  14323. Function
  14324.                    Restore the screen mode.
  14325. Syntax
  14326.                    restorecrtmode;
  14327. Remarks
  14328.                    Restore the screen mode to its original state before
  14329.  
  14330.  Programmer's Reference Guide       - 243 -         TEGL Windows Toolkit
  14331.  
  14332.  
  14333.  
  14334.  
  14335.  
  14336.                         Graphics Library - tgraph
  14337.  
  14338.                    graphics was initialized.
  14339. See also
  14340.                    detectgraph, initgraph
  14341.  
  14342.  
  14343.  
  14344. ___________________________________________________________________________
  14345.  
  14346. setbkcolor                                                                 
  14347. ___________________________________________________________________________
  14348.  
  14349.  
  14350. Function
  14351.                    Sets the backgound color.
  14352. Syntax
  14353.                    void far setbkcolor(int color);
  14354. Remarks
  14355.                    Background colors may range from 0 to 15.
  14356. See also
  14357.                    getbkcolor,setcolor
  14358.  
  14359.  
  14360.  
  14361. ___________________________________________________________________________
  14362.  
  14363. setcolor                                                                   
  14364. ___________________________________________________________________________
  14365.  
  14366.  
  14367. Function
  14368.                    set the drawing color.
  14369. Syntax
  14370.                    setcolor(int color);
  14371. Remarks
  14372.                    Drawing colors may range from 0 to 15.
  14373. See also
  14374.                    getcolor
  14375.  
  14376.  
  14377.  
  14378. ___________________________________________________________________________
  14379.  
  14380. setfillpattern                                                             
  14381. ___________________________________________________________________________
  14382.  
  14383.  
  14384. Function
  14385.                    Selects a user-defined fill pattern.
  14386. Syntax
  14387.                    void far setfillpattern(char far *upattern, int color);
  14388.  
  14389.  Programmer's Reference Guide       - 244 -         TEGL Windows Toolkit
  14390.  
  14391.  
  14392.  
  14393.  
  14394.  
  14395.                         Graphics Library - tgraph
  14396.  
  14397. Remarks
  14398.                    Sets the pattern and color for all filling done by
  14399.                    bar.
  14400. See also
  14401.                    getfillpattern, setfillstyle
  14402.  
  14403.  
  14404.  
  14405. ___________________________________________________________________________
  14406.  
  14407. setfillstyle                                                               
  14408. ___________________________________________________________________________
  14409.  
  14410.  
  14411. Function
  14412.                    Sets the fill pattern and color.
  14413. Syntax
  14414.                    void far setfillstyle(int pattern,int color);
  14415. Remarks
  14416.                    Set the pattern and color for all filling done by
  14417.                    bar. There are 12 fill patterns available.
  14418. See also
  14419.                    getfillsettings
  14420.  
  14421.  
  14422.  
  14423. ___________________________________________________________________________
  14424.  
  14425. settextjustify                                                             
  14426. ___________________________________________________________________________
  14427.  
  14428.  
  14429. Function
  14430.                    Sets text justification values used by outtextxy
  14431.                    and outtegltextxy.
  14432. Syntax
  14433.                    settextjustify(int horiz, int vert);
  14434. Remarks
  14435.                    The default justification settings are settextjustify(
  14436.                    lefttext, toptext).
  14437. See also
  14438.                    gettextsettings, outtextxy
  14439.  
  14440.  
  14441.  
  14442.  
  14443.  
  14444.  
  14445.  
  14446.  
  14447.  
  14448.  Programmer's Reference Guide       - 245 -         TEGL Windows Toolkit
  14449.  
  14450.  
  14451.  
  14452.  
  14453.  
  14454.                               APPENDICES
  14455.  
  14456.  
  14457. Appendix A - Overlapping Graphics
  14458. ___________________________________________________________________________
  14459.  
  14460. There are many methods in creating and managing overlapping windows,
  14461. however the end result to the user must be in the context of windows that
  14462. form independent layers on a single display.
  14463.  
  14464. This section discusses the method that is used with the TEGL Windowing
  14465. Manager.
  14466.  
  14467.  
  14468. Video Buffers
  14469.  
  14470. The video buffer is a block of memory where displayable data is stored.  A
  14471. program may read and write to the video buffer in the same way it accesses
  14472. any other memory.
  14473.  
  14474. The video display circuitry updates the screen by continually reading the
  14475. data in the video buffer and translating the bit information to the
  14476. screen. Each group of bits in the video buffer specifies the color and
  14477. brightness of a particular location on the screen. A particular location
  14478. on the screen is known as a pixel. If a program changes the contents of
  14479. the video buffer, the screen reflects the change immediately.
  14480.  
  14481. Because you have control over each pixel in the displayed image, you can
  14482. construct complex geometric images, fill arbitrary areas of the screen
  14483. with blends of colors, or create animated images that moves across the
  14484. screen.
  14485.  
  14486. We may think of windows as multiple video buffers, the distinction is that,
  14487. with the TEGL Windows Toolkit, only 1 video buffer is used. To create a
  14488. window effect, we must physically copy and move display data to and from a
  14489. single video buffer, overlaying the images as we would layout images on
  14490. paper.
  14491.  
  14492.  
  14493. Windows
  14494.  
  14495. Windows are simply predefined rectangular areas of the screen. A window
  14496. manager is a coordinator that ensures that images related to a window are
  14497. saved (stored in memory) before other overlapping images writes to the
  14498. screen. When a window is closed, the underlying image is copied back to
  14499. screen video buffer.
  14500.  
  14501. The basis of a window manager is the copying and restoring of multiple
  14502. areas of the screen.
  14503.  
  14504.  
  14505. Frames
  14506.  
  14507.  Programmer's Reference Guide       - 246 -         TEGL Windows Toolkit
  14508.  
  14509.  
  14510.  
  14511.  
  14512.  
  14513.                               APPENDICES
  14514.  
  14515.  
  14516. An EGA video has a maximum resolution of 640 pixels horizontal by 350
  14517. pixels. The coordinates are specified as (x,y) and (x1,y1), where x and y
  14518. are the horizontal and vertical position respectively. The position is
  14519. relative to upper left coordinate which has a coordinate value of (0,0).
  14520.  
  14521.                               (x,y)
  14522.                                 +---------+
  14523.                                 |(y)      |
  14524.                                 ||        |
  14525.                                 ||        |
  14526.                                 |*        |
  14527.                                 |         |
  14528.                                 |(x)----->|
  14529.                                 +---------+
  14530.                                        (x1,y1)
  14531.  
  14532. A Frame Stack
  14533.  
  14534. A frame stack is a list with each entry representing a screen area. Each
  14535. entry contains information and data that is required by the window manager
  14536. to coordinate the overlaps between frames.
  14537.  
  14538. The order of the list is in the same order as the frames are stacked on
  14539. the screen.
  14540.  
  14541.  
  14542. A Simple Window Manager
  14543.  
  14544. This section talks about creating a simple window manager. We will use
  14545. the following example to see how we can update frame (A) independent of
  14546. the other 3 frames.
  14547.  
  14548. The following frames have called PUSHIMAGE to save the underlying
  14549. graphics.
  14550.  
  14551.                                  +----------------+
  14552.                        +---------+--+             |
  14553.                        |            |             |
  14554.                        |            |--+          |
  14555.                        |            |B |  A       |
  14556.                        | D          |--+          |
  14557.                        |            |             |
  14558.                        |            |--+          |
  14559.                        |            |C |          |
  14560.                        |            |--+          |
  14561.                        |            |             |
  14562.                        +---------+--+             |
  14563.                                  |                |
  14564.                                  +----------------+
  14565.  
  14566.  Programmer's Reference Guide       - 247 -         TEGL Windows Toolkit
  14567.  
  14568.  
  14569.  
  14570.  
  14571.  
  14572.                               APPENDICES
  14573.  
  14574.  
  14575. In order for Frame (A) to be updated, the image for Frame (D) is saved, and
  14576. Frame (D) is erased from the screen
  14577. by restoring the the underlying image that was saved previously.
  14578.  
  14579.                                  +----------------+
  14580.                                  |                |
  14581.                                  |                |
  14582.                            +-----|-----+          |
  14583.                            |  B  |     |  A       |
  14584.                            +-----|-----+          |
  14585.                                  |                |
  14586.                            +-----|-----+          |
  14587.                            |  C  |     |          |
  14588.                            +-----|-----+          |
  14589.                                  |                |
  14590.                                  |                |
  14591.                                  |                |
  14592.                                  +----------------+
  14593.  
  14594. The image for Frame (C) is saved, and Frame (C) is erased from the screen
  14595. by restoring the the underlying image that was saved previously.
  14596.  
  14597.                                  +----------------+
  14598.                                  |                |
  14599.                                  |                |
  14600.                            +-----|-----+          |
  14601.                            |  B  |     |  A       |
  14602.                            +-----|-----+          |
  14603.                                  |                |
  14604.                                  |                |
  14605.                                  |                |
  14606.                                  |                |
  14607.                                  |                |
  14608.                                  |                |
  14609.                                  |                |
  14610.                                  +----------------+
  14611.  
  14612. The image for Frame (B) is saved, and Frame (B) is erased from the screen
  14613. by restoring the the underlying image that was saved previously.
  14614.  
  14615.                                  +----------------+
  14616.                                  |                |
  14617.                                  |                |
  14618.                                  |                |
  14619.                                  |        A       |
  14620.                                  |                |
  14621.                                  |                |
  14622.                                  |                |
  14623.                                  |                |
  14624.  
  14625.  Programmer's Reference Guide       - 248 -         TEGL Windows Toolkit
  14626.  
  14627.  
  14628.  
  14629.  
  14630.  
  14631.                               APPENDICES
  14632.  
  14633.                                  |                |
  14634.                                  |                |
  14635.                                  |                |
  14636.                                  |                |
  14637.                                  +----------------+
  14638.  
  14639. The composite image of (A) is now complete and can be updated. The images
  14640. (B), (C) and (D) are restored by reversing the above steps.
  14641.  
  14642. In the earlier generations of TEGL, this formed the basis of the stacked
  14643. frame concept (the removal of images that overlaps the current).
  14644.  
  14645.  
  14646. Partial Image Update
  14647.  
  14648. As you can imagine, this process is slow and causes a lot a of unnecessary
  14649. updates to the screen. With the foundation of q a simple window manager,
  14650. we can now begin to refine this process.
  14651.  
  14652. Partial image update is removing only the intersection portion of the
  14653. frames from the screen by extracting a section of the saved image.
  14654.  
  14655. The following shows the intersection of D,C and B that is needed to
  14656. be replaced on the screen.
  14657.  
  14658.                                  +--+
  14659.                                  |D |
  14660.                                  |  |  +-----+
  14661.                                  |  |  |B    |
  14662.                                  |  |  +-----+
  14663.                                  |  |  +-----+
  14664.                                  |  |  |C    |
  14665.                                  |  |  +-----+
  14666.                                  +--+
  14667.  
  14668. Partial Image (D) is replaced first, followed by Partial (C) and (B).
  14669.  
  14670. Refined Partial Image Update
  14671.  
  14672. Since we are only interested in the composite image of (A), there is still
  14673. a lot of unnecessary update to the screen.
  14674.  
  14675. Imagine a notepad and you wish to write on the fifth page of the notepad.
  14676. The fastest way to lift up five pages in a
  14677. group, write, and close the notepad.
  14678.  
  14679. So let's split image (D) into 5 pieces.
  14680.  
  14681.       +--+
  14682.       |D1|
  14683.  
  14684.  Programmer's Reference Guide       - 249 -         TEGL Windows Toolkit
  14685.  
  14686.  
  14687.  
  14688.  
  14689.  
  14690.                               APPENDICES
  14691.  
  14692.       +--+
  14693.       +--+--+
  14694.       |D2| B|
  14695.       +--+--+
  14696.       +--+
  14697.       |D3|
  14698.       +--+
  14699.       +--+--+
  14700.       |D4| C|
  14701.       +--+--+
  14702.       +--+
  14703.       |D5|
  14704.       +--+
  14705.  
  14706. Notice the double pages of (D2)(B) and (D4)(C).  Now we only need to
  14707. replace (D1), (B), (D3), (C) and (D5). We don't need to replace (D2) and
  14708. (D4) because (B) and (C) has already restored the composite image of (A).
  14709.  
  14710. TEGL was further refined to (cut out) only the pieces that needs to
  14711. be replaced, thus removing all unnecessary updates to the screen.
  14712.  
  14713.  
  14714. A Refined Partial Image Update Algorithm
  14715.  
  14716.  
  14717. check for condition where by replacing the bottom image
  14718. will replace the top image. eg.
  14719.  
  14720.                              +----------------+
  14721.                              |1 +---------+   |
  14722.                              |  | 2 +-----+   |
  14723.                              |  |   |  3  |   |
  14724.                              |  +---+-----+   |
  14725.                              +----------------+
  14726.  
  14727. Replacing 3 will be redundant, since we want to update 1, replacing 2
  14728. will remove both 2 and 3.
  14729.  
  14730. check if we can begin trim the ends off one of the overlapped
  14731. images to reduce the size that we need to replace.
  14732.  
  14733. +---------+ +---------+ +---------+  +---------+ +---+---------+ +---------+---+
  14734. |   +-----+ | +-----+ | +-----+   |  |     :   | |   | :       | |       : |   |
  14735. +---|.....| +-|.....|-+ |.....|---+  +---------+ |   +---------+ +---------+   |
  14736.     |     |   |     |   |     |      |     |     |     |                 |     |
  14737.     |     |   |     |   |     |      +-----+     +-----+                 +-----+
  14738.     +-----+   +-----+   +-----+      +-----+     +-----+                 +-----+
  14739. +---+-----+ +-+-----+-+ +-----+---+  +---------+ |   +---------+ +---------+   |
  14740. |   |     | | |     | | |     |   |  |     :   | |   | :       | |       : |   |
  14741. +---|.....| +-|.....|-+ |.....|---+  +---------+ |   +---------+ +---------+   |
  14742.  
  14743.  Programmer's Reference Guide       - 250 -         TEGL Windows Toolkit
  14744.  
  14745.  
  14746.  
  14747.  
  14748.  
  14749.                               APPENDICES
  14750.  
  14751.     |     |   |     |   |     |      +-----+     +-----+                 +-----+
  14752.     +-----+   +-----+   +-----+      +-----+              +-----+     +-----+
  14753.     +-----+   +-----+   +-----+      |     |              |     |     |     |
  14754.     |     |   |     |   |     |      +---------+  +---------+   | +---------+
  14755. +---|.....| +-|.....|-+ |.....|---+  |     :   |  |       : |   | |   :     |
  14756. |   |     | | |     | | |     |   |  +---------+  +---------+---+ +---------+
  14757. +---+-----+ +-+-----+-+ +-----+---+  +-----+            +-----+  +---------+
  14758.     +-----+   +-----+   +-----+      |     |        +---------+  |   :     |
  14759.     |     |   |     |   |     |      |   +---------+|   :     |  +---------+
  14760.     |     |   |     |   |     |      |   | :       |+---------+      |     |
  14761. +---|.....| +-|.....|-+ |.....|---+  +---+---------+    +-----+      +-----+
  14762. |   +-----+ | +-----+ | +-----+   |
  14763. +---------+ +---------+ +---------+
  14764.  
  14765.  create an new insert that has one end trimmed and repeat steps 1
  14766. through 3 to cut the images into the necessary pieces.
  14767.  
  14768.     +-----+   +-----+   +-----+     +---------+   +-----+     +-----+
  14769. +---|     | +-|     |-+ |     |---+ |       : | +---------+   |     |
  14770. |   |     | | |     | | |     |   | +---------+ |       : | +---------+
  14771. +---|.....| +-|.....|-+ |.....|---+   |     |   +---------+ |       : |
  14772.     +-----+   +-----+   +-----+       +-----+     +-----+   +---------+
  14773.                                 +-----+-------+                 +-------+-----+
  14774.         +-----+ +-----+         |     |       | +-----+ +-----+ |       |     |
  14775. +-------|.....| |.....|-------+ |.....|-------+ |     | |     | +-------|.....|
  14776. |       |     | |     |       | |     | +-------|.....| |.....|-------+ |     |
  14777. +-------|     | |     |-------+ +-----+ |       |     | |     |       | +-----+
  14778.         +-----+ +-----+                 +-------+-----+ +-----+-------+
  14779. +---------++-----++---------+    +---------+    +---------++-----++---------+
  14780. |.........||     ||.........|---+|.........|+---|.........||     ||.........|
  14781. +---------+|     |+---------+   |+---------+|   +---------+|     |+---------+
  14782.     |     ||.....|-------+|     |  |     |  |     |+-------|.....||     |
  14783.     |     |+-----+       ||     |  |     |  |     ||       +-----+|     |
  14784.     +-----+    +---------++-----+  +-----+  +-----++---------+    +-----+
  14785. +-----+    +-----++---------+      +-----+      +---------++-----+    +-----+
  14786. |     |    |     ||       +-----+  |     |  +-----+       ||     |    |     |
  14787. |     |    |     |+-------|.....|  |     |  |.....|-------+|     |    |     |
  14788. +---------+|   +---------+|     |+---------+|     |+---------+   |+---------+
  14789. |.........|+---|.........||     ||.........||     ||.........|---+|.........|
  14790. +---------+    +---------++-----++---------++-----++---------+    +---------+
  14791.  
  14792. The only time that we are unable to split an overlapping image is when
  14793. the image overlaps by 1 pixel.
  14794.  
  14795.                                     +---------+
  14796.                                     |         |
  14797.                          +----------|         |-----------+
  14798.                          |          +----+---------+      |
  14799.                          +---------------|         |------+
  14800.                                          |         |
  14801.  
  14802.  Programmer's Reference Guide       - 251 -         TEGL Windows Toolkit
  14803.  
  14804.  
  14805.  
  14806.  
  14807.  
  14808.                               APPENDICES
  14809.  
  14810.                                          +---------+
  14811.  
  14812.  
  14813.  
  14814. A Quick Run through the algorithm
  14815.  
  14816. The procedure to handle the splitting of images is called
  14817. StackOverlaps. StackOverlaps works in the following fashion:
  14818.  
  14819.                    Top (Stackptr)*                              Bottom
  14820.                +--+---------+-----+---+        Top      +----------------+
  14821.                |D |x,y,x1,y1|image|...|       +---------+--+             |
  14822.                +--+---------+-----+---+       |            |             |
  14823.                +--+---------+-----+---+       |            |--+          |
  14824.                |C |x,y,x1,y1|image|...|       |            |B |  A       |
  14825.                +--+---------+-----+---+       | D          |--+          |
  14826.                +--+---------+-----+---+       |            |             |
  14827.                |A |x,y,x1,y1|image|...|       |            |--+          |
  14828.                +--+---------+-----+---+       |            |C |          |
  14829.                +--+---------+-----+---+       |            |--+          |
  14830.                |A |x,y,x1,y1|image|...|       |            |             |
  14831.                +--+---------+-----+---+       +---------+--+             |
  14832.                    Bottom                               |                |
  14833.                                                         +----------------+
  14834.  
  14835. PrepareForUpdate(A) creates temporary stack entries:
  14836.  
  14837.                    Top (Stackptr)*
  14838.                +--+---------+-----+---+
  14839.         +----> |B1|x,y,x1,y1|image|...|
  14840.         |      +--+---------+-----+---+
  14841.         |      +--+---------+-----+---+                  +----------------+
  14842.         | +--> |C1|x,y,x1,y1|image|...|        +---------+--+             |
  14843.         | |    +--+---------+-----+---+        |         |D1|             |
  14844.         | |    +--+---------+-----+---+        |         +-----+          |
  14845.         | | +> |D1|x,y,x1,y1|image|...|        |         |B1   |  A       |
  14846.         | | |  +--+---------+-----+---+        | D       +-----+          |
  14847.         | | |  +--+---------+-----+---+        |         +-----+          |
  14848.         | | +> |D |x,y,x1,y1|image|...|        |         |C1   |          |
  14849.         | |    +--+---------+-----+---+        |         +-----+          |
  14850.         | |    +--+---------+-----+---+        |         |  |             |
  14851.         | +--> |C |x,y,x1,y1|image|...|        +---------+--+             |
  14852.         |      +--+---------+-----+---+                  |                |
  14853.         |      +--+---------+-----+---+                  +----------------+
  14854.         +----> |B |x,y,x1,y1|image|...|
  14855.                +--+---------+-----+---+
  14856.                +--+---------+-----+---+
  14857.                |A |x,y,x1,y1|image|...|
  14858.                +--+---------+-----+---+
  14859.                    Bottom
  14860.  
  14861.  Programmer's Reference Guide       - 252 -         TEGL Windows Toolkit
  14862.  
  14863.  
  14864.  
  14865.  
  14866.  
  14867.                               APPENDICES
  14868.  
  14869.  
  14870. Begin Cutting and Eliminating: Comparing only the overlapped images.
  14871.  
  14872.                +--+---------+-----+---+             +--+        +--+
  14873.         +----> |B1|x,y,x1,y1|image|...| Bottom      |D1|        |D1|
  14874.         |      +--+---------+-----+---+     Image   |  |--+     |  |
  14875.         |      +--+---------+-----+---+             |  |B1|     |  |
  14876.         | +--> |C1|x,y,x1,y1|image|...|             |  |--+     |  |
  14877.         | |    +--+---------+-----+---+             |  |        |  |
  14878.         | |    +--+---------+-----+---+             |  |        |  |--+
  14879.         | | +> |D1|x,y,x1,y1|image|...| Top Image   |  |        |  |C1|
  14880.         | | |  +--+---------+-----+---+             |  |        |  |--+
  14881.                                                     |  |        |  |
  14882.                                                     +--+        +--+
  14883.  
  14884. StackOverlaps compares B1 with D1, B1 with C1 and
  14885. C1 with D1 for overlaps.
  14886.  
  14887.  
  14888.  
  14889.  
  14890. eliminate redundant overlaps
  14891.  
  14892.  
  14893.  
  14894.  
  14895.  
  14896.  
  14897.  
  14898. Appendix B - Heap Management
  14899. ___________________________________________________________________________
  14900.  
  14901. One of the major problems with window management is the amount of dynamic
  14902. memory that is allocated and de-allocated.  Memory is constantly
  14903. fragmented with records, dynamic variables, and window images, thus
  14904. reducing the largest block size over a period of time.
  14905.  
  14906.            Empty Heap Memory                     Fragmented Heap Memory
  14907.  
  14908.            Top of DOS Memory                       Top of DOS Memory
  14909. FreePtr-> +-----------------+                     +-----------------+
  14910.           |        *        |                     |-----------------|1--+
  14911.           |                 |           FreePtr-> |-----------------|2--|+
  14912.           |                 |                     |                 |   ||
  14913.           |                 |                     |    Free Space   |   ||
  14914.           |                 |                     |       60k       |   ||
  14915.           |                 |           HeapPtr-> |-----------------|   ||
  14916.           |        *        |                     |-----------------|   ||
  14917.           |    cmaxavail    |                     |                 |   ||
  14918.           |      341k       |                     |    Free Space   |   ||
  14919.  
  14920.  Programmer's Reference Guide       - 253 -         TEGL Windows Toolkit
  14921.  
  14922.  
  14923.  
  14924.  
  14925.  
  14926.                               APPENDICES
  14927.  
  14928.           |        *        |                     |       70k       |   ||
  14929.           |                 |                     |                 |   ||
  14930.           |                 |                     |-----------------|2<-|+
  14931.           |                 |                     |-----------------|   |
  14932.           |                 |                     |    Free Space   |   |
  14933.           |                 |                     |        *        |   |
  14934.           |                 |                     |     cmaxavail   |   |
  14935.           |                 |                     |      102k       |   |
  14936.           |                 |                     |        *        |   |
  14937.           |        *        |                     |                 |   |
  14938. HeapPtr-> |-----------------| <-----HeapOrg-----> |-----------------|1<-+
  14939.           |   * Program *   |                     |   * Program *   |
  14940.  
  14941. This chapter will discuss how the TEGL heap manager using 
  14942. reservehugeminimum reduces the fragmentation that occurs.
  14943.  
  14944. TEGL Heap Manager
  14945.  
  14946. There are only two main pointers that manages the heap. The heapptr
  14947. points to the end of the last memory block. freeptr points to a list
  14948. of free memory blocks that can be re-used.
  14949.  
  14950.            Top of DOS Memory
  14951.           +-----------------+
  14952.           |-----------------|1--+
  14953. FreePtr-> |-----------------|2--|+
  14954.           |                 |   ||
  14955.           |    Free Space   |   ||
  14956.           |       60k       |   ||
  14957. HeapPtr-> |-----------------|   ||
  14958.           |-----------------|   ||
  14959.           |                 |   ||
  14960.           |    Free Space   |   ||
  14961.           |       70k       |   ||
  14962.           |                 |   ||
  14963.           |-----------------|2<-|+
  14964.           |-----------------|   |
  14965.           |    Free Space   |   |
  14966.           |        *        |   |
  14967.           |    cmaxavail    |   |
  14968.           |      102k       |   |
  14969.           |        *        |   |
  14970.           |                 |   |
  14971.           |-----------------|1<-+
  14972.           |   * Program *   |
  14973.  
  14974. When memory is requested from the TEGL Heap Manager, a sequential
  14975. scan of the freeptr chain is made to see if any of the free memory
  14976. space can be re-used. Any free space that satisfy the requested size will
  14977. be used.
  14978.  
  14979.  Programmer's Reference Guide       - 254 -         TEGL Windows Toolkit
  14980.  
  14981.  
  14982.  
  14983.  
  14984.  
  14985.                               APPENDICES
  14986.  
  14987.  
  14988. The free space is then reduced by the allocation size and removed from the
  14989. freeptr chain if the block is completely allocated.
  14990.  
  14991. cgetmem(102k)
  14992.  
  14993.            Top of DOS Memory                      Top of DOS Memory
  14994.           +-----------------+                    +-----------------+
  14995.           |-----------------|1--+      FreePtr-> |-----------------|2--+
  14996. FreePtr-> |-----------------|2--|+               |                 |   |
  14997.           |                 |   ||               |                 |   |
  14998.           |    Free Space   |   ||               |    Free Space   |   |
  14999.           |       60k       |   ||               |       60k       |   |
  15000. HeapPtr-> |-----------------|   ||     HeapPtr-> |-----------------|   |
  15001.           |-----------------|   ||               |-----------------|   |
  15002.           |                 |   ||               |                 |   |
  15003.           |    Free Space   |   ||               |    Free Space   |   |
  15004.           |       70k       |   ||               |       70k       |   |
  15005.           |                 |   ||               |                 |   |
  15006.           |-----------------|2<-|+               |-----------------|2<-+
  15007.           |-----------------|   |                |/////////////////|
  15008.           |    Free Space   |   |                |/////////////////|
  15009.           |        *        |   |                |/////////////////|
  15010.           |    cmaxavail    |   |                |/////////////////|
  15011.           |      102k       |   |                |/////////////////|
  15012.           |        *        |   |                |/////////////////|
  15013.           |                 |   |                |/////////////////|
  15014.           |-----------------|1<-+                |-----------------|
  15015.           |   * Program *   |                    |   * Program *   |
  15016.  
  15017. cgetmem(20k)
  15018.  
  15019.            Top of DOS Memory                      Top of DOS Memory
  15020.           +-----------------+                    +-----------------+
  15021.           |-----------------|1--+                |-----------------|1--+
  15022. FreePtr-> |-----------------|2--|+     FreePtr-> |-----------------|2--|+
  15023.           |                 |   ||               |                 |   ||
  15024.           |    Free Space   |   ||               |    Free Space   |   ||
  15025.           |       60k       |   ||               |       60k       |   ||
  15026. HeapPtr-> |-----------------|   ||     HeapPtr-> |-----------------|   ||
  15027.           |-----------------|   ||               |-----------------|   ||
  15028.           |                 |   ||               |    Free Space   |   ||
  15029.           |    Free Space   |   ||               |       50k       |   ||
  15030.           |       70k       |   ||               |-----------------|2<-|+
  15031.           |                 |   ||               |/////////////////|   |
  15032.           |-----------------|2<-|+               |-----------------|   |
  15033.           |-----------------|   |                |-----------------|   |
  15034.           |    Free Space   |   |                |    Free Space   |   |
  15035.           |        *        |   |                |        *        |   |
  15036.           |    cmaxavail    |   |                |    cmaxavail    |   |
  15037.  
  15038.  Programmer's Reference Guide       - 255 -         TEGL Windows Toolkit
  15039.  
  15040.  
  15041.  
  15042.  
  15043.  
  15044.                               APPENDICES
  15045.  
  15046.           |      102k       |   |                |      102k       |   |
  15047.           |        *        |   |                |        *        |   |
  15048.           |                 |   |                |                 |   |
  15049.           |-----------------|1<-+                |-----------------|1<-+
  15050.           |   * Program *   |                    |   * Program *   |
  15051.  
  15052. When memory is released (freed), the TEGL Heap Manager
  15053. sequentially scans the freeptr chain to see if any of the free memory
  15054. space is adjacent to the memory block that is being freed.
  15055.  
  15056. cfreemem(A)
  15057.  
  15058.            Top of DOS Memory                      Top of DOS Memory
  15059.           +-----------------+                    +-----------------+
  15060.           |-----------------|1--+                |-----------------|1--+
  15061.           |-----------------|2--|+               |--------x--------|2--|+
  15062.           |--------x--------|3--||+              |-----------------|5--||--+
  15063.           |-----------------|4--|||+   FreePtr-> |-----------------|4--||+ |
  15064. FreePtr-> |-----------------|5--||||+            |        *        |   ||| |
  15065.           |        *        |   |||||            |                 |   ||| |
  15066.           |                 |   |||||            |                 |   ||| |
  15067.           |                 |   |||||            |                 |   ||| |
  15068.           |                 |   |||||            |                 |   ||| |
  15069.           |        *        |   |||||            |        *        |   ||| |
  15070. HeapPtr-> |-----------------|   |||||  HeapPtr-> |-----------------|   ||| |
  15071.           |+++++++++++++++++|   |||||            |+++++++++++++++++|   ||| |
  15072.           |+++++++++++++++++|2<-|+|||            |+++++++++++++++++|2<-|+| |
  15073.     (A)>>>|+++++++++++++++++|   | |||            |                 |   | | |
  15074.           |+++++++++++++++++|3<-|-+||      (A)>>>|-----------------|   | | |
  15075.           |+++++++++++++++++|   |  ||            |+++++++++++++++++|   | | |
  15076.           |+++++++++++++++++|5<-|--|+            |+++++++++++++++++|5<-|-|-+
  15077.           |+++++++++++++++++|   |  |             |+++++++++++++++++|   | |
  15078.           |+++++++++++++++++|1<-+  |             |+++++++++++++++++|1<-+ |
  15079.           |+++++++++++++++++|      |             |+++++++++++++++++|     |
  15080.           |+++++++++++++++++|4<----+             |+++++++++++++++++|4<---+
  15081.           |   * Program *   |                    |   * Program *   |
  15082.  
  15083. If adjacent memory is found, the free space pointer is removed from the
  15084. freeptr chain and TEGL's heap manager takes the most recent
  15085. entry and moves it to fill the now empty position. The size and the
  15086. original pointer (A) is adjusted to reflect a new pointer position and
  15087. size.
  15088.  
  15089.            Top of DOS Memory                      Top of DOS Memory
  15090.           +-----------------+                    +-----------------+
  15091.           |-----------------|1--+                |-----------------|1--+
  15092.           |-----------------|4--|-+              |-----------------|4--|-+
  15093. FreePtr-> |-----------------|5--|-|+             |-----------------|5--|-|+
  15094.           |        *        |   | ||   FreePtr-> |-----------------|A--|+||
  15095.           |                 |   | ||             |                 |   ||||
  15096.  
  15097.  Programmer's Reference Guide       - 256 -         TEGL Windows Toolkit
  15098.  
  15099.  
  15100.  
  15101.  
  15102.  
  15103.                               APPENDICES
  15104.  
  15105.           |                 |   | ||             |                 |   ||||
  15106.           |                 |   | ||             |                 |   ||||
  15107.           |                 |   | ||             |                 |   ||||
  15108.           |                 |   | ||             |                 |   ||||
  15109.           |        *        |   | ||             |        *        |   ||||
  15110. HeapPtr-> |-----------------|   | ||   HeapPtr-> |-----------------|   ||||
  15111.           |-----------------|   | ||             |+++++++++++++++++|   ||||
  15112.           |                 |   | ||             |||||||||||||||||||   ||||
  15113.           |                 |   | ||             |||||||||||||||||||   ||||
  15114.     (A)>>>|-----------------|   | ||             |+++++++++++++++++|A<-|+||
  15115.           |+++++++++++++++++|   | ||             |+++++++++++++++++|   | ||
  15116.           |+++++++++++++++++|5<-|-|+             |+++++++++++++++++|5<-|-|+
  15117.           |+++++++++++++++++|   | |              |+++++++++++++++++|   | |
  15118.           |+++++++++++++++++|1<-+ |              |+++++++++++++++++|1<-+ |
  15119.           |+++++++++++++++++|     |              |+++++++++++++++++|     |
  15120.           |+++++++++++++++++|4<---+              |+++++++++++++++++|4<---+
  15121.           |   * Program *   |                    |   * Program *   |
  15122.  
  15123. When all possible adjacent blocks have been removed, the TEGL heap
  15124. manager checks if the end of memory block is equal to the heapptr. If
  15125. not, a free space entry is added to the bottom of freeptr.
  15126.  
  15127. cfreemem(B)
  15128.  
  15129.            Top of DOS Memory                      Top of DOS Memory
  15130.           +-----------------+                    +-----------------+
  15131.           |-----------------|1--+                |-----------------|1--+
  15132.           |-----------------|4--|-+              |-----------------|4--|-+
  15133.           |-----------------|5--|-|+   FreePtr-> |-----------------|5--|-|+
  15134. FreePtr-> |--------x--------|A--|+||             |        *        |   | ||
  15135.           |        *        |   ||||             |                 |   | ||
  15136.           |                 |   ||||             |                 |   | ||
  15137.           |                 |   ||||             |                 |   | ||
  15138.           |                 |   ||||             |                 |   | ||
  15139.           |                 |   ||||             |                 |   | ||
  15140.           |        *        |   ||||             |                 |   | ||
  15141. HeapPtr-> |-----------------|   ||||             |                 |   | ||
  15142.     (B)>>>|-----------------|   ||||             |                 |   | ||
  15143.           |                 |   ||||             |                 |   | ||
  15144.           |                 |   ||||             |        *        |   | ||
  15145.           |-----------------|A<-|+||   HeapPtr-> |-----------------|   | ||
  15146.           |+++++++++++++++++|   | ||             |+++++++++++++++++|   | ||
  15147.           |+++++++++++++++++|5<-|-|+             |+++++++++++++++++|5<-|-|+
  15148.           |+++++++++++++++++|   | |              |+++++++++++++++++|   | |
  15149.           |+++++++++++++++++|1<-+ |              |+++++++++++++++++|1<-+ |
  15150.           |+++++++++++++++++|     |              |+++++++++++++++++|     |
  15151.           |+++++++++++++++++|4<---+              |+++++++++++++++++|4<---+
  15152.           |   * Program *   |                    |   * Program *   |
  15153.  
  15154. The TEGL memory manager sorts the free space entries, so that all
  15155.  
  15156.  Programmer's Reference Guide       - 257 -         TEGL Windows Toolkit
  15157.  
  15158.  
  15159.  
  15160.  
  15161.  
  15162.                               APPENDICES
  15163.  
  15164. allocation of space using cgetmem will always be towards the lower
  15165. part of the heap memory.
  15166.  
  15167. TEGL Upper Heap Manager
  15168.  
  15169. The TEGL fgetmem is slightly different in its management methods.
  15170. Allocation of memory is always attempted between heapptr and 
  15171. freeptr before searching for free space within the freeptr chain.
  15172.  
  15173. fgetmem(20k)
  15174.  
  15175.            Before                   cgetmem                   fgetmem
  15176.           +-------+                 +-------+                 +-------+
  15177.           |-------|1--+             |-------|1--+             |-------|1--+
  15178. FreePtr-> |-------|2--|+  FreePtr-> |-------|2--|+  FreePtr-> |-------|2--|+
  15179.           |   *   |   ||            |   *   |   ||            |  40k  |   ||
  15180.           |  60k  |   ||            |  60k  |   ||            |-------|   ||
  15181.           |   *   |   ||            |   *   |   ||            |///////|   ||
  15182. HeapPtr-> |-------|   ||  HeapPtr-> |-------|   ||  HeapPtr-> |-------|   ||
  15183.           |-------|   ||            |-------|   ||            |-------|   ||
  15184.           |       |   ||            |   *   |   ||            |       |   ||
  15185.           |   *   |   ||            |  50k  |   ||            |   *   |   ||
  15186.           |  70k  |   ||            |-------|2<-|+            |  70k  |   ||
  15187.           |   *   |   ||            |///////|   |             |   *   |   ||
  15188.           |-------|2<-|+            |-------|   |             |-------|2<-|+
  15189.           |-------|   |             |-------|   |             |-------|   |
  15190.           |       |   |             |       |   |             |       |   |
  15191.           |       |   |             |       |   |             |       |   |
  15192.           |   *   |   |             |   *   |   |             |   *   |   |
  15193.           | 102k  |   |             | 102k  |   |             | 102k  |   |
  15194.           |   *   |   |             |   *   |   |             |   *   |   |
  15195.           |       |   |             |       |   |             |       |   |
  15196.           |-------|1<-+             |-------|1<-+             |-------|1<-+
  15197.           |Program|                 |Program|                 |Program|
  15198.  
  15199. When memory is released (freed), fgetmem uses cfreemem to
  15200. release the memory block back into the heap.
  15201.  
  15202. cfreemem(A)
  15203.  
  15204.            Top of DOS Memory                      Top of DOS Memory
  15205.           +-----------------+                    +-----------------+
  15206.           |-----------------|1--+                |-----------------|1--+
  15207.           |--------x--------|2--|+               |-----------------|3--|-+
  15208.           |-----------------|3--||+              |-----------------|4--|-|+
  15209.           |-----------------|4--|||+   FreePtr-> |-----------------|5--|-||+
  15210. FreePtr-> |-----------------|5--||||+            |        *        |   | |||
  15211.           |        *        |   |||||            |                 |   | |||
  15212.           |                 |   |||||            |                 |   | |||
  15213.           |                 |   |||||            |                 |   | |||
  15214.  
  15215.  Programmer's Reference Guide       - 258 -         TEGL Windows Toolkit
  15216.  
  15217.  
  15218.  
  15219.  
  15220.  
  15221.                               APPENDICES
  15222.  
  15223.           |                 |   |||||            |                 |   | |||
  15224.           |        *        |   |||||            |        *        |   | |||
  15225. HeapPtr-> |-----------------|   |||||  HeapPtr-> |-----------------|   | |||
  15226.           |+++++++++++++++++|   |||||            |+++++++++++++++++|   | |||
  15227.           |+++++++++++++++++|1<-+||||            |+++++++++++++++++|1<-+ |||
  15228.     (A)>>>|+++++++++++++++++|    ||||            |                 |     |||
  15229.           |+++++++++++++++++|2<--+|||      (A)>>>|-----------------|     |||
  15230.           |+++++++++++++++++|     |||            |+++++++++++++++++|     |||
  15231.           |+++++++++++++++++|3<---+||            |+++++++++++++++++|3<---+||
  15232.           |+++++++++++++++++|      ||            |+++++++++++++++++|      ||
  15233.           |+++++++++++++++++|4<----+|            |+++++++++++++++++|4<----+|
  15234.           |+++++++++++++++++|       |            |+++++++++++++++++|       |
  15235.           |+++++++++++++++++|5<-----+            |+++++++++++++++++|5<-----+
  15236.           |   * Program *   |                    |   * Program *   |
  15237.  
  15238. If adjacent memory is found, the free space pointer is removed from the
  15239. FreePtr chain and TEGL's heap manager moves the free chain structure
  15240. up by one entry to close the empty position. The size and the original
  15241. pointer (A) is adjusted to reflect a new pointer position and size.
  15242.  
  15243.            Top of DOS Memory                      Top of DOS Memory
  15244.           +-----------------+                    +-----------------+
  15245.           |-----------------|3----+              |-----------------|A--+
  15246.           |-----------------|4----|+             |-----------------|3--|-+
  15247. FreePtr-> |-----------------|5----||+            |-----------------|4--|-|+
  15248.           |        *        |     |||  FreePtr-> |-----------------|5--|-||+
  15249.           |                 |     |||            |                 |   | |||
  15250.           |                 |     |||            |                 |   | |||
  15251.           |                 |     |||            |                 |   | |||
  15252.           |                 |     |||            |                 |   | |||
  15253.           |                 |     |||            |                 |   | |||
  15254.           |        *        |     |||            |        *        |   | |||
  15255. HeapPtr-> |-----------------|     |||  HeapPtr-> |-----------------|   | |||
  15256.           |-----------------|     |||            |+++++++++++++++++|   | |||
  15257.           |                 |     |||            |||||||||||||||||||   | |||
  15258.           |                 |     |||            |||||||||||||||||||   | |||
  15259.     (A)>>>|-----------------|     |||            |+++++++++++++++++|A<-+ |||
  15260.           |+++++++++++++++++|     |||            |+++++++++++++++++|     |||
  15261.           |+++++++++++++++++|3<---+||            |+++++++++++++++++|3<---+||
  15262.           |+++++++++++++++++|      ||            |+++++++++++++++++|      ||
  15263.           |+++++++++++++++++|4<----+|            |+++++++++++++++++|4<----+|
  15264.           |+++++++++++++++++|       |            |+++++++++++++++++|       |
  15265.           |+++++++++++++++++|5<-----+            |+++++++++++++++++|5<-----+
  15266.           |   * Program *   |                    |   * Program *   |
  15267.  
  15268. When all possible adjacent blocks have been removed, the TEGL heap manager
  15269. checks if the end of memory block is equal to the HeapPtr. If not, a free
  15270. space entry is added to the bottom of FreePtr.
  15271.  
  15272. cfreemem(B)
  15273.  
  15274.  Programmer's Reference Guide       - 259 -         TEGL Windows Toolkit
  15275.  
  15276.  
  15277.  
  15278.  
  15279.  
  15280.                               APPENDICES
  15281.  
  15282.  
  15283.            Top of DOS Memory                      Top of DOS Memory
  15284.           +-----------------+                    +-----------------+
  15285.           |-----------------|A--+                |-----------------|3----+
  15286.           |-----------------|3--|-+              |-----------------|4----|+
  15287.           |-----------------|4--|-|+   FreePtr-> |-----------------|5----||+
  15288. FreePtr-> |--------x--------|5--|-||+            |        *        |     |||
  15289.           |        *        |   | |||            |                 |     |||
  15290.           |                 |   | |||            |                 |     |||
  15291.           |                 |   | |||            |                 |     |||
  15292.           |                 |   | |||            |                 |     |||
  15293.           |                 |   | |||            |                 |     |||
  15294.           |        *        |   | |||            |                 |     |||
  15295. HeapPtr-> |-----------------|   | |||            |                 |     |||
  15296.     (B)>>>|-----------------|   | |||            |                 |     |||
  15297.           |                 |   | |||            |                 |     |||
  15298.           |                 |   | |||            |        *        |     |||
  15299.           |-----------------|A<-+ |||  HeapPtr-> |-----------------|     |||
  15300.           |+++++++++++++++++|     |||            |+++++++++++++++++|     |||
  15301.           |+++++++++++++++++|3<---+||            |+++++++++++++++++|3<---+||
  15302.           |+++++++++++++++++|      ||            |+++++++++++++++++|      ||
  15303.           |+++++++++++++++++|4<----+|            |+++++++++++++++++|4<----+|
  15304.           |+++++++++++++++++|       |            |+++++++++++++++++|       |
  15305.           |+++++++++++++++++|5<-----+            |+++++++++++++++++|5<-----+
  15306.           |   * Program *   |                    |   * Program *   |
  15307.  
  15308. TEGL uses the more efficient method of maintaining the free space chain in
  15309. sorted order.  This allows allocation of memory to favor the lower portion
  15310. of the heap.  This does not remove the fragmentation problem where one
  15311. non-movable records is allocated in the middle of the heap.
  15312.  
  15313.  
  15314. Combining the best of both Heap Managers (Coexisting)
  15315.  
  15316. What we noted that we needed was the ability to have two heaps. One for
  15317. miscellaneous dyanamic variables and one for large allocations for images.
  15318. Combined with the virtual memory handler, this allows the paging out the
  15319. large allocations effectively releasing adjacent memory. At the same time
  15320. we did not want to limit either heap. The lower heap must have the ability
  15321. to flow over to the second heap without problems.
  15322.  
  15323. ReserveHugeMinimum provides an elegant solution of partitioning the
  15324. standard heap into two parts. A single non-movable byte is allocated as a
  15325. partitioner.
  15326.  
  15327.                                     cgetmem                 fgetmem
  15328.           +-------+                +-------+                +-------+
  15329. FreePtr-> |-------|1--+  FreePtr-> |-------|1--+  FreePtr-> |-------|1--+
  15330.           |       |   |            |       |   |            |       |   |
  15331.           |       |   |            |       |   |            |       |   |
  15332.  
  15333.  Programmer's Reference Guide       - 260 -         TEGL Windows Toolkit
  15334.  
  15335.  
  15336.  
  15337.  
  15338.  
  15339.                               APPENDICES
  15340.  
  15341.           |       |   |            |       |   |            |       |   |
  15342.           |       |   |            |       |   |            |       |   |
  15343.           |  329k |   |            |  329k |   |            |  200k |   |
  15344.           |       |   |            |       |   |            |       |   |
  15345.           |       |   |            |       |   |  HeapPtr-> |-------|   |
  15346.           |       |   |            |       |   |            |///////|   |
  15347.           |       |   |            |       |   |            |///////|   |
  15348.           |HugeMin|   |            |HugeMin|   |            |///////|   |
  15349. HeapPtr-> |-------|   |  HeapPtr-> |-------|   |            |-------|   |
  15350.           |       |   |            |       |   |            |       |   |
  15351.           |       |   |            |       |   |            |       |   |
  15352.           |  12k  |   |            |  11k  |   |            |  11k  |   |
  15353.           |       |   |            |       |   |            |       |   |
  15354.           |       |   |            |       |   |            |       |   |
  15355.           |       |   |            |-------|1<-+            |-------|1<-+
  15356.           |       |   |            |///////|                |///////|
  15357.           |-------|1<-+            |-------|                |-------|
  15358.           |Program|                |Program|                |Program|
  15359.  
  15360. cgetmem will always search for free space through the 
  15361. FreePtr Chain, the lower partitioned area will always be used first (it
  15362. is always the first few entries in the freeptr chain).
  15363.  
  15364. fgetmem used by the window manager will always attempt to allocate
  15365. space between heapptr and freeptr before searching through the
  15366. free space pointer chain.  Even when searching through the free space
  15367. chain, a comparison is made on the minimum area for allocating.  When TEGL
  15368. frees a memory block, the free space pointer is sorted upwards into the
  15369. free space chain.
  15370.  
  15371.            Top of DOS Memory
  15372.           +-----------------+
  15373.       +--A|-----------------|
  15374.      +|--B|-----------------|
  15375.     +||--C|-----------------|
  15376.    +|||--D|-----------------|
  15377.   +||||--E|-----------------|
  15378.   |||||   |-----------------|4--+
  15379.   |||||   |-----------------|1--|+
  15380.   |||||   |-----------------|3--||+
  15381.   |||||   |-----------------|2--|||+
  15382.   |||||   |-----------------|5--||||+
  15383.   |||||   |                 |   |||||
  15384.   ||||+->A|+++++++++++++++++|   |||||
  15385.   |||+-->B|+++++++++++++++++|   |||||
  15386.   ||+--->C|+++++++++++++++++|   |||||
  15387.   |+---->D|+++++++++++++++++|   |||||
  15388.   +----->E|+++++++++++++++++|   |||||
  15389.           |    Hugemin      |   |||||
  15390.           |-----------------|   |||||
  15391.  
  15392.  Programmer's Reference Guide       - 261 -         TEGL Windows Toolkit
  15393.  
  15394.  
  15395.  
  15396.  
  15397.  
  15398.                               APPENDICES
  15399.  
  15400.           |+++++++++++++++++|2<-|+|||
  15401.           |+++++++++++++++++|3<-|-+||
  15402.           |+++++++++++++++++|5<-|--|+
  15403.           |+++++++++++++++++|4<-+  |
  15404.           |+++++++++++++++++|2<----+
  15405.           |   * Program *   |
  15406.  
  15407.  
  15408.  
  15409.  
  15410.  
  15411.  
  15412.  
  15413.  
  15414.  
  15415.  
  15416.  
  15417.  
  15418.  
  15419.  
  15420.  
  15421.  
  15422.  
  15423.  
  15424.  
  15425.  
  15426.  
  15427.  
  15428.  
  15429.  
  15430.  
  15431.  
  15432.  
  15433.  
  15434.  
  15435.  
  15436.  
  15437.  
  15438.  
  15439.  
  15440.  
  15441.  
  15442.  
  15443.  
  15444.  
  15445.  
  15446.  
  15447.  
  15448.  
  15449.  
  15450.  
  15451.  Programmer's Reference Guide       - 262 -         TEGL Windows Toolkit
  15452.  
  15453.  
  15454.  
  15455.  
  15456.  
  15457.                            Conditional Compilation
  15458.  
  15459. The file teglcond.h contains conditions compilation directives that
  15460. support different facilities with the Toolkit.
  15461.  
  15462. Note! If you change any defines you will have to make the entire toolkit.
  15463.  
  15464. The following defines affect the Toolkit:
  15465.  
  15466. #define NOGR - The toolkit is built with no explicit references to
  15467. graphics.lib provided with Turbo C. Instead a compatible module 
  15468. tgraph is used which provides a subset of the functions provided in 
  15469. graphics.lib If your application does not need all the features of the
  15470. Graph unit then compiling with this directive enabled can save as
  15471. much as 25K of code size in a program (assuming the BGI drivers are linked
  15472. in).
  15473.  
  15474. #define NOVIRT - The code that implements virtual memory using either
  15475. EMS or a disk drive is not included. Applications save about 8K of code
  15476. space but can easily run out of memory if many windows are opened. This
  15477. is more critical for EGA or VGA displays since the windows require four
  15478. times as much memory than CGA or Hurcules displays.
  15479.  
  15480. #define QUICKC - The toolkit will be built assuming that a Microsoft C
  15481. compiler is being used.
  15482.  
  15483. #define TURBOC - The toolkit will be built assuming that the Turbo C
  15484. compiler is being used.
  15485.  
  15486.  
  15487.  
  15488.  
  15489.  
  15490.  
  15491.  
  15492.  
  15493.  
  15494.  
  15495.  
  15496.  
  15497.  
  15498.  
  15499.  
  15500.  
  15501.  
  15502.  
  15503.  
  15504.  
  15505.  
  15506.  
  15507.  
  15508.  
  15509.  
  15510.  Programmer's Reference Guide       - 263 -         TEGL Windows Toolkit
  15511.  
  15512.  
  15513.  
  15514.  
  15515.  
  15516.                                 INDEX
  15517.  
  15518.  Bar menu................................................... 94
  15519.  Bar........................................................237
  15520.  Click and drag............................................. 24
  15521.  EGA........................................................144
  15522.  Event driven code.......................................... 23
  15523.  Expand and shrink.......................................... 25
  15524.  FGAND...................................................... 77
  15525.  FGNORN..................................................... 77
  15526.  FGNOT...................................................... 77
  15527.  FGOR....................................................... 77
  15528.  FGXOR...................................................... 77
  15529.  FontTable..................................................192
  15530.  Jagged..................................................... 97
  15531.  Keyboard events............................................ 25
  15532.  Mickey.....................................................124
  15533.  MoveFromVirtual procedure..................................223
  15534.  MsSense.................................................... 84
  15535.  MxClick.................................................... 84
  15536.  OE......................................................... 96
  15537.  OM......................................................... 95
  15538.  Option entry............................................... 96
  15539.  Option menu................................................ 95
  15540.  Proportional...............................................192
  15541.  ReadKey.................................................... 91
  15542.  TEGLSupervisor............................................. 24
  15543.  Timer ticks................................................ 25
  15544.  VGA........................................................139
  15545.  abort_msg..................................................149
  15546.  activebutton............................................... 30
  15547.  addcapturekey..............................................131
  15548.  addframe...................................................184
  15549.  allocateexpandedmemorypages................................205
  15550.  animate....................................................186
  15551.  animatecomplete............................................186
  15552.  animateinit................................................185
  15553.  asksoundsense..............................................197
  15554.  beep.......................................................198
  15555.  bigimagesize...............................................143
  15556.  cfreemem...................................................203
  15557.  cga640x200x2...............................................136
  15558.  cgetmem....................................................202
  15559.  checkctrlbreak.............................................233
  15560.  checkctrlbreakfs...........................................233
  15561.  checkformouseselect........................................173
  15562.  checkmouseclickpos.........................................172
  15563.  clearbuttoninfo............................................121
  15564.  clearkeyboardbuf........................................... 90
  15565.  clearteglkeyboardbuf....................................... 90
  15566.  clearteglscreen............................................151
  15567.  closegraph.................................................238
  15568.  
  15569.  Programmer's Reference Guide       - 264 -         TEGL Windows Toolkit
  15570.  
  15571.  
  15572.  
  15573.  
  15574.  
  15575.                                 INDEX
  15576.  
  15577.  cmaxavail..................................................225
  15578.  collapsetoiconshow.........................................165
  15579.  collapsetomsclick..........................................166
  15580.  coltox..................................................... 31
  15581.  commitupdate............................................... 61
  15582.  countframes................................................ 49
  15583.  createbarmenu..............................................105
  15584.  createimagebuffer.......................................... 74
  15585.  createoptionmenu........................................... 96
  15586.  createshadowom............................................. 98
  15587.  currentframenumber.........................................185
  15588.  cursorshape................................................117
  15589.  deallocateexpandedmemorypages..............................207
  15590.  definebuttonclick..........................................163
  15591.  defineglobalkeyclickarea................................... 91
  15592.  definelocalkeyclickarea.................................... 92
  15593.  definelongbuttonclick......................................164
  15594.  definemouseclickarea....................................... 84
  15595.  defineoptionclickarea......................................110
  15596.  defineoptions.............................................. 97
  15597.  defineresizeclickarea......................................228
  15598.  defineresizeminmax.........................................229
  15599.  definesliderarea...........................................229
  15600.  defineuserbuttonclick......................................164
  15601.  deletecapturekey...........................................132
  15602.  destination................................................181
  15603.  detectgraph................................................238
  15604.  drawlongbutton.............................................170
  15605.  dropimagebuffer............................................ 75
  15606.  dropkeyclick............................................... 92
  15607.  dropsliders................................................230
  15608.  dropstackimage............................................. 54
  15609.  droptimercount.............................................129
  15610.  droptimertick..............................................234
  15611.  easytegl................................................... 36
  15612.  editstring.................................................196
  15613.  ega640x350x16..............................................137
  15614.  emminstalled...............................................204
  15615.  emsblockread...............................................215
  15616.  emsblockwrite..............................................214
  15617.  emsclose...................................................216
  15618.  emsopen....................................................213
  15619.  emspagesavailable..........................................205
  15620.  emsseek....................................................214
  15621.  errmess.................................................... 31
  15622.  explodefromiconhide........................................166
  15623.  explodefrommsclick.........................................167
  15624.  extendtextxy...............................................162
  15625.  extractimg.................................................146
  15626.  extractpixs................................................146
  15627.  
  15628.  Programmer's Reference Guide       - 265 -         TEGL Windows Toolkit
  15629.  
  15630.  
  15631.  
  15632.  
  15633.  
  15634.                                 INDEX
  15635.  
  15636.  fastline...................................................140
  15637.  findframe..................................................171
  15638.  findkeyclickptr............................................ 93
  15639.  findmouseclickptr.......................................... 85
  15640.  findsliderfs...............................................230
  15641.  fitframe................................................... 32
  15642.  flipapage..................................................144
  15643.  flipvpage..................................................145
  15644.  fmttegltextxy..............................................189
  15645.  fontname...................................................193
  15646.  frameexist................................................. 49
  15647.  framefromicon.............................................. 32
  15648.  frameselectandmove......................................... 63
  15649.  frametext.................................................. 33
  15650.  freeimagebuffer............................................ 77
  15651.  freevirtual................................................224
  15652.  freezemouse................................................123
  15653.  frozenmouse................................................122
  15654.  getbiti....................................................142
  15655.  getbkcolor.................................................238
  15656.  getbuttonpressinfo.........................................121
  15657.  getbuttonreleaseinfo.......................................120
  15658.  getcolor...................................................239
  15659.  getfillpattern.............................................239
  15660.  getfrontimage.............................................. 78
  15661.  getfsimage................................................. 76
  15662.  getgraphmode...............................................240
  15663.  gethandlecountused.........................................208
  15664.  getkbsteps.................................................127
  15665.  getmaxx....................................................240
  15666.  getmaxy....................................................240
  15667.  getmousesensitivity........................................125
  15668.  getmousey.................................................. 34
  15669.  getorigin..................................................180
  15670.  getpageframebaseaddress....................................206
  15671.  getpagesownedbyhandle......................................209
  15672.  getpartialfrontimage....................................... 78
  15673.  getpixs....................................................141
  15674.  gettextsettings............................................241
  15675.  getversionnumber...........................................207
  15676.  getyesno................................................... 35
  15677.  graphresult................................................241
  15678.  herc720x348x2..............................................137
  15679.  hideimage.................................................. 56
  15680.  hidemouse..................................................116
  15681.  imagesize..................................................241
  15682.  initgraph..................................................242
  15683.  keystackptr................................................ 93
  15684.  lastcol.................................................... 36
  15685.  lastrow.................................................... 37
  15686.  
  15687.  Programmer's Reference Guide       - 266 -         TEGL Windows Toolkit
  15688.  
  15689.  
  15690.  
  15691.  
  15692.  
  15693.                                 INDEX
  15694.  
  15695.  line.......................................................242
  15696.  linkfs..................................................... 72
  15697.  linkunderfs................................................ 73
  15698.  lockimage.................................................. 79
  15699.  mapexpandedmemorypages.....................................206
  15700.  mcursoroff.................................................114
  15701.  mcursoron..................................................115
  15702.  mouseposition..............................................119
  15703.  movebox....................................................167
  15704.  moveframe.................................................. 70
  15705.  movestackimage............................................. 68
  15706.  movetovirtual..............................................224
  15707.  msclick.................................................... 24
  15708.  msetpos....................................................115
  15709.  mssense.................................................... 24
  15710.  nilkeycallproc.............................................133
  15711.  nilunitproc................................................234
  15712.  origin procedure...........................................180
  15713.  outbaroption...............................................106
  15714.  outframetextxy............................................. 38
  15715.  outtegltextxy..............................................189
  15716.  outtextxy..................................................243
  15717.  overlaparea................................................235
  15718.  overlayimg.................................................147
  15719.  pageinfs................................................... 79
  15720.  pageoutfs.................................................. 80
  15721.  pageoutimagestack.......................................... 81
  15722.  pictsize...................................................149
  15723.  popimage................................................... 51
  15724.  prepareforpartialupdate.................................... 58
  15725.  prepareforupdate........................................... 60
  15726.  pressbutton................................................174
  15727.  pushimage.................................................. 50
  15728.  putbiti....................................................142
  15729.  putfsimage................................................. 76
  15730.  putpict.................................................... 45
  15731.  putpict....................................................149
  15732.  putpixs....................................................141
  15733.  putuserbuttonclick.........................................165
  15734.  quickframe................................................. 39
  15735.  quit....................................................... 38
  15736.  rectangle..................................................243
  15737.  replaceoptiontext..........................................102
  15738.  reservehugeminimum.........................................227
  15739.  resetframe.................................................182
  15740.  resetkeyclickcallproc...................................... 93
  15741.  resetmouseclicks........................................... 88
  15742.  resetmsclickactive......................................... 87
  15743.  resetmsclickcallproc....................................... 87
  15744.  resetmsclicksense.......................................... 89
  15745.  
  15746.  Programmer's Reference Guide       - 267 -         TEGL Windows Toolkit
  15747.  
  15748.  
  15749.  
  15750.  
  15751.  
  15752.                                 INDEX
  15753.  
  15754.  resetoptionmenuevents......................................111
  15755.  resetsequence..............................................183
  15756.  resettimerflag.............................................129
  15757.  resizeframe................................................231
  15758.  resizeoptionmenu........................................... 99
  15759.  restorecrtmode.............................................243
  15760.  restoretext................................................ 39
  15761.  rotatestackimage........................................... 52
  15762.  rotateunderstackimage...................................... 53
  15763.  rowtoy..................................................... 40
  15764.  selectafile................................................195
  15765.  selectandmoveframe.........................................232
  15766.  selecteasytext............................................. 40
  15767.  sequence...................................................182
  15768.  setapage...................................................143
  15769.  setautorotate.............................................. 64
  15770.  setbarbordercolor..........................................108
  15771.  setbarborderoff............................................108
  15772.  setbarfillstyle............................................109
  15773.  setbarmenucolor............................................107
  15774.  setbarmenumargin...........................................109
  15775.  setbarshadowtext...........................................108
  15776.  setbartextcolor............................................107
  15777.  setbkcolor.................................................244
  15778.  setcolor...................................................244
  15779.  seteasyfont................................................ 41
  15780.  setfillpattern.............................................244
  15781.  setfillstyle...............................................245
  15782.  setframemobility........................................... 66
  15783.  sethidesubmenu.............................................104
  15784.  setimagecoordinates........................................ 81
  15785.  setkbsteps.................................................126
  15786.  setkeyboardmouse...........................................125
  15787.  setmousecolor..............................................119
  15788.  setmousehotspot............................................119
  15789.  setmouseminmax.............................................122
  15790.  setmouseposition...........................................116
  15791.  setmousesense..............................................197
  15792.  setmousesensitivity........................................124
  15793.  setmoveframecallproc....................................... 67
  15794.  setmoverestrictions........................................ 65
  15795.  setoptionmenubordercolor...................................104
  15796.  setoptionmenucolors........................................103
  15797.  setproportional............................................192
  15798.  setshadowbordercolor.......................................157
  15799.  setshadowcolor.............................................156
  15800.  setshadowfillpattern.......................................157
  15801.  setshadowfillstyle.........................................158
  15802.  setshadowtexthighlight.....................................161
  15803.  setshadowtextshadow........................................160
  15804.  
  15805.  Programmer's Reference Guide       - 268 -         TEGL Windows Toolkit
  15806.  
  15807.  
  15808.  
  15809.  
  15810.  
  15811.                                 INDEX
  15812.  
  15813.  setshadowtexttype..........................................160
  15814.  setshiftkeys...............................................134
  15815.  setslideposition...........................................232
  15816.  setteglbackcolor...........................................152
  15817.  setteglbordercolor.........................................153
  15818.  setteglbordershow..........................................152
  15819.  setteglfillpattern procedure...............................154
  15820.  setteglfillstyle...........................................154
  15821.  setteglfont................................................192
  15822.  settextjustify.............................................245
  15823.  settimerstart..............................................128
  15824.  settimertick...............................................235
  15825.  setvideochoices............................................138
  15826.  setvpage...................................................144
  15827.  shadowbox..................................................155
  15828.  shadowboxtext..............................................156
  15829.  shadowtext.................................................159
  15830.  shadowtexthighlightoff.....................................161
  15831.  shifttextxy................................................162
  15832.  showbuttonstatus...........................................134
  15833.  showcoordinates............................................ 58
  15834.  showfonts..................................................193
  15835.  showimage.................................................. 57
  15836.  showmouse..................................................116
  15837.  showonefont................................................193
  15838.  slidebeep..................................................198
  15839.  soundswitch................................................199
  15840.  spawn......................................................113
  15841.  super vga..................................................138
  15842.  svga800x600x16.............................................138
  15843.  swapbytes..................................................147
  15844.  swapteglintroff............................................113
  15845.  swapteglintron.............................................114
  15846.  swaptimerin................................................128
  15847.  swaptimerout...............................................127
  15848.  teglcharheight.............................................191
  15849.  teglcharwidth..............................................191
  15850.  teglkeypressed.............................................133
  15851.  teglreadkey................................................132
  15852.  teglsupervisor............................................. 19
  15853.  tegltextwidth..............................................190
  15854.  teglwrtchar................................................191
  15855.  timerswtich................................................129
  15856.  togglecheckmark............................................100
  15857.  toggleentrystatus..........................................101
  15858.  toggleoptionbar............................................103
  15859.  unfreezemouse..............................................124
  15860.  unlinkfs................................................... 70
  15861.  unlockimage................................................ 82
  15862.  unuseimage................................................. 82
  15863.  
  15864.  Programmer's Reference Guide       - 269 -         TEGL Windows Toolkit
  15865.  
  15866.  
  15867.  
  15868.  
  15869.  
  15870.                                 INDEX
  15871.  
  15872.  useharddisk................................................223
  15873.  useimage................................................... 83
  15874.  vdskcloseheapfile..........................................221
  15875.  vdskfreemem................................................219
  15876.  vdskgetmem.................................................219
  15877.  vdskopenheapfile...........................................217
  15878.  vdskreadheapdata...........................................221
  15879.  vdskwriteheapdata..........................................220
  15880.  vemsopenheapfile...........................................218
  15881.  vga640x480x16..............................................138
  15882.  videoautodetect............................................139
  15883.  videoid....................................................139
  15884.  videopage..................................................145
  15885.  vidid......................................................136
  15886.  virtualmemused.............................................225
  15887.  visualbuttonpress..........................................175
  15888.  xorbox.....................................................148
  15889.  xorcornerbox...............................................148
  15890.  zipfrombox.................................................169
  15891.  ziptobox...................................................168
  15892.  
  15893.  
  15894.  
  15895.  
  15896.  
  15897.  
  15898.  
  15899.  
  15900.  
  15901.  
  15902.  
  15903.  
  15904.  
  15905.  
  15906.  
  15907.  
  15908.  
  15909.  
  15910.  
  15911.  
  15912.  
  15913.  
  15914.  
  15915.  
  15916.  
  15917.  
  15918.  
  15919.  
  15920.  
  15921.  
  15922.  
  15923.